I get asked this question a lot and I know it can be confusing. So to simplify it, I believe this article said it best.
A domain name is your website’s address on the internet where people can access your website. It is something that internet users type in the browser’s URL bar to visit your site.
Web hosting is the storage location where your website content files are placed. It’s like the home of your website.
If your domain name was the address of your house, then the actual house is your hosting server. You need both a domain name and web hosting to create a website.
I also get asked if a person should have their domain registration and hosting at the same company. You can go that route, but I usually recommend having your domain at a separate company from your web hosting. That way if you were to change host companies, you won’t have to transfer your domain to do it. I recommend GoDaddy for your domain registration and Siteground for your hosting.