How to get Category URL from field in Matrix
{{ block.linkTo.first().url() }} looks basically right, but a couple of things could be going wrong here:


Does the Galleries category have a url assigned? (make sure the "Categories in this group have their own URLs" box is checked)
Is there a category? You should always check, even if it is a required field. You can do {% if block.linkTo.first() %}...{% endif %} or {{ block.linkTo.first().url() ?? '' }} and use the A null coalescing operator.