DNS Lookup Problems

Occasionally, I get DNS problems with certain websites, where it will fail to get the IP address.
The issue goes away if I use a VPN or my phone as a hotspot for my Wi-Fi.
For the record, I’m on NixOS 23.05 with NetworkManager. I tried manually setting DNS server to 1.1.1.1 and 8.8.8.8, but none seemed to work. It also doesn’t depend on the network I’m connected to
What can be causing this?

hard to say,

what does dig / nslookup say? do they have the same problem?

do you have any logs that might be helpful?

what websites are you having trouble with?

it can be a lot of things, sounds like your upstream dns servers is overloaded, or loosing packet and replies.

what dns server are you using on VPN? can you hotwire your dns server to use that when off VPN.

get back to me.