Welcome to the Microsoft Q&A Platform. Thank you for reaching out & I hope you are doing well.
It is recommend that you restart your VMs and Application gateway for the new DNS Server changes to be updated.
Refer : Change DNS servers of a virtual network
Restart the VMs that are connected to the virtual network, so they're assigned the new DNS server settings. VMs continue to use their current DNS settings until they're restarted
For App gateway, see : Why am I seeing 502 errors or unhealthy backend servers after I changed the DNS servers for the virtual network?
The instances of your application gateway use the virtual network's DNS configuration for name resolution. After changing any DNS server configuration, you need to restart (Stop and Start) the application gateway for the new DNS servers to get assigned. Until then, FQDN-based name resolutions for outbound connectivity could fail.
Kindly let us know if this helps or you need further assistance on this issue.
Thanks,
Kapil
Please don’t forget to close the thread by clicking "Accept the answer" wherever the information provided helps you, as this can be beneficial to other community members.