Reliable way to set DNS
Go into WiFi Settings > (Press and hold) the preferred network connection > (Click) Modify network config > (Check) Show advance options > (Select) Static (instead of DHCP) > [Under DSN 1 and DSN 2 enter your choice) > (Click) Save

This will work for wifi.  I don't think it will change the DNS provided by your phone carrier.

When you specify static you are overriding the DHCP distribution of the router.  You would have to specify an IP address outside of the specified automatic range pool