How to get the current page url or some different url from a *.phtml template?

Of course, you can use the universal solution described here: How to get the current HTTP request URL programmatically in PHP?
It works from at any code point, not only from a *.phtml template.

But from a *.phtml template you can do it shorter by calling the \Magento\Framework\View\Element\AbstractBlock::getUrl() method:

$block->getUrl();

or

$block->getUrl('adminhtml/notification/index');

An example from the core: