I know URLS that have underscores in the hostname, so I'm unsure how that's invalid.
Do name one please. (spoiler you won't find any.)
A hostname may only contain the letters 'A' to 'Z' (case does not matter), '0' to '9', and a hyphen. (internationalization extended domain names a little bit, still not to include an underscore.)