Is there any way in Drupal 8 to know whats the current page url in custom module.

I mean if I call dsm, then on every page it should give me that page's url.

I know the function to get current path, but dont know where to call them