WHAT IS DNS IN ANDROID?
In easy words, When you type something like google.com, the DNS looks up the IP address, so content can be loaded. It's a critical part of modern networking, but Android has never had an option for a global DNS setting. If you wanted to change the server, you would have to do it on a per-network basis, while using a static IP address.
You can easily understand how it works, In the above image, it has shown that whenever we search for something on a domain like google.com, those queries aren't encrypted it means they are easily accessible by a third party.
Now comes these DNS settings, which encrypts all DNS queries so they can't be read or modified by anyone. Not all DNS providers support that technology, but several popular ones do, like Google and Cloudflare.
SO, HOW TO CHANGE THESE SETTINGS?
Nowadays, almost every android device supports these settings. To do so:-
1. Go to the Settings option in your device.
2. Then go to Connections / Other Wireless connections, in this, you will find an option "PRIVATE DNS".
3. Now In this option, enter either the Google or Cloudflare's hostname in the Private DNS provider option.
4. You can do that easily, for Google Public DNS, you have to use dns.google and for CloudFlare, you can put in 1dot1dot1dot1.cloudflare-dns.com