If you connect to a corporate VPN it doesn’t resolve the corporate internal domains!
It seems you need something like splitDNS but haven’t managed to configure it.
Currently Ubuntu does not offer an easy way to set up a “global” DNS for all network connections: whenever you connect to a new WiFi network, if you don’t want to use the DNS server provided by the WiFi, you are forced to go to the network settings and manually set your preferred DNS server.https://andrea.corbellini.name/2020/04/28/ubuntu-global-dns/
Chosen Provider – Quad9:
Has IPV6 too.