How do I convert "entity:node/9 in a link? I need to get some values from a custom block I've created, and I am using the following code.

// Get the block
$block = \Drupal\block\Entity\Block::load('hightlight');

// Get the block content
$uuid = $block-&gt;getPlugin()-&gt;getDerivativeId();
$block_content = \Drupal::service('entity.repository')-&gt;loadEntityByUuid('block_content', $uuid);

// Get the field value
$field = $block_content-&gt;get('field_link')-&gt;getValue()[0];


The problem is that the field contains entity:node/9. Is it possible to convert that value in a link?

This is the content of the field.
You have to rewrite

$value = $block_content-&gt;get('field_link')-&gt;getValue()[0];


to something like this:

$value = $block_content-&gt;get('field_link')-&gt;first()-&gt;getUrl()-&gt;toString();


See What is the correct way to get the link url?