IP addresses are assigned to each device that connects to the internet, whether it is a home computer or a server located in a data centre.
The principle function of a domain name server is to point a memorable name to a numeric IP address. For example, you can visit Google.com by visiting http://18.104.22.168/, however the domain name Google is much easier to remember.
We would all find it difficult to remember the addresses of websites if we had to use their IP addresses to access them. That is why we rely on domain name servers, or as they are commonly referred, DNS.
When you move to a new hosting company, you will be asked to point your domain name to a specific location. For example, you may be asked to point your domain name to ns1.hostingcompany.com and ns2.hostingcompany.com.
These addresses are known as domain name servers and they point to a specific IP address. Therefore, when a hosting company asks you to change your name servers, they are essentially asking you to point your domain name to a specific IP address. This ensures that when a visitor types in your domain name into the address bar, they are taken to the server where your website files are hosted.
All you have to do is log into your domain registrar and modify the domain name servers.
If you have a VPS plan or dedicated server, you probably want to create your own custom name server using your own domain name. Doing this allows you to modify the DNS zones on your server and disguises the fact your DNS requests are handled by the hosting company. Custom domain name servers are also better for branding.