Android Pie, or P, offers the ability to use the DNS-over-TLS capable DNS servers of your choice. This also solves the problem of having to install third party applications to change the phone's default DNS servers without dealing with the mess of manual configurations. See more about the Private DNS mode here.
To enable this setting and to change the servers, navigate to Android's system settings menu.
From here, tap "Network & Internet" and click "Advanced" to see the "Private DNS" options.
Now tap the"Private DNS" option, then choose "Private DNS Provider Hostname" and enter the hostname of your favorite DNS provider.