Some ways to make links in drupal 8

// Link to an internal path defined by a route.
$link = Link::createFromRoute('This is some link', 'entity.node.canonical', ['node' => 22])

// Link to an external URI.
$link = Link::fromTextAndUrl('This is a link', Url::fromUri('https://example.com'));

// Get output as a render array.
$link->toRenderable();

// Get output as a string.
$link->toString();