ubuntu 22.04 using systemd-resolvd configuration like netplan:
If you have Dekstop version with network manager installed:
nmcli dev show | grep DNS
For earlier Ubuntu servers:
cat /etc/resolv.conf will give you some info about how you resolve, however it won't show you the nameservers anymoew.
because Ubuntu uses dnsmasq, resolvconf, or more recently systemd to get it's name servers from Network Manager.