How can I render an URL path from a custom route?
Twig

You can use the route name in the twig function url():

&lt;a href="{{ url('module_new') }}"&gt;{{ 'View my module content'|t }}&lt;/a&gt;


Controller

Or you can do the same in a controller:

use Drupal\Core\Url;

  $url = Url::fromRoute('module_new', [], ['absolute' =&gt; TRUE]);

  // get the path as string (not recommended)
  $path = $url-&gt;toString;

  // better put the complete url object in a render array and let the template render it
  $build['link'] = [
   '#title' =&gt; $this-&gt;t('My module content'),
   '#type' =&gt; 'link',
   '#url' =&gt; $url,
  ];

  return $build;