Use resolvconf. If not installed then do:
sudo apt update
sudo apt upgrade -y
sudo apt install resolvconf
Start the service with systemd:
systemctl start resolvconf
systemctl enable resolvconf --now
systemctl status resolvconf
Now DNS configuration can be changed by editing /etc/resolvconf/resolv.conf.d/head file.
After changes are made:
resolvconf --enable-updates
resolvconf -u