This App works without a rooted phone.
To make this possible all traffic is redirected using a VPN. This VPN redirects your traffic only locally, the data never leaves your phone using this VPN connection.
You'll be asked to allow the VPN connection in the next window, without permission from you the set DNS servers won't work.
Source code can be found under https://git.frostnerd.com/PublicAndroidApps/DnsChanger.