Replace url() with path() for dashboard url

It's not better to use the relative dashboard url generated with the path() twig function instead of the absolute url using the url() function?

I noticed in a project of mine (the hosting server have some special settings regarding the public hostname) that the dashboard url is wrong generated using url(), with path() it is perfect.