How do I convert "entity:node/9 in a link?
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?