In Magento 2, You can get Base Url, Current Url, get Media URL, get static page URL and custom URL using Magento\Store\Model\StoreManagerInterface and Magento\Framework\UrlInterface Object.
Using StoreManager Object,
Create PHP file and Passed Dependency injection Magento\Store\Model\StoreManagerInterface,
