Yes, in principle it has the same effect as if you hard-coded your website URL there.
Two caveats:
1) It allows your site to work with multiple URLs. This is probably mostly OK, but it's possible that strange things will happen if you use it like that. For example, suppose a module decides to save a link to a file with its full absolute URL, as it appears to be when the file is uploaded. If you then show up using the other URL and follow that link, you may hit the login wall of the site with the original URL and be made to log in again before you can see the file.
2) It relies on your Moodle being accessed via the web server. If you try to use a command-line tool like the CLI version of the cron, $_SERVER['HTTP_HOST'] won't be set and any code that runs won't know what your site URL is. (I'm not sure whether it will do a sanity check at that point and give up or just carry on merrily assuming that your site is at "https://", which may or may not be a problem depending what information the tasks your cron runs happen to need.)
You could probably happily use Moodle set up like that without running into either of those problems, but if you know what your site URL is and it isn't going to change for a while, you're probably better off hard-coding it, which is the conventional way to do it.