While web hosting and domain names may be two separate things, you can’t have one without the other when it comes to running a website. They both work together in order to ensure users can access a website.
Domain names are addresses for websites – so think of your website as a house. Your domain name is your house address e.g. “5 Queens Close”, whilst your web hosting is the actual bricks and mortar house that the address directs to. Both complement each other.