On Windows I used to reach for nslookup out of habit. In PowerShell, Resolve-DnsName does the same job and gives you objects you can filter, which suits me better.
Resolve-DnsName example.com -Type MX -Server 1.1.1.1
-Type picks the record type: A, AAAA, MX, TXT, CNAME and so on. Without it you get A and AAAA. -Server sends the question to a DNS server of your choice instead of the one your network adapter uses. That makes it easy to compare what your Pi-hole or router says with what a public resolver says.
Two switches I find useful when something does not add up:
Resolve-DnsName nas.local -NoHostsFile
Resolve-DnsName intranet -DnsOnly
-NoHostsFile skips the hosts file, so an old entry there cannot fool you. -DnsOnly uses only DNS and leaves LLMNR and NetBIOS out, which helps when a short name resolves on your LAN and you want to know whether DNS had anything to do with it.
Because the output is objects, you can pipe it into Format-Table or Where-Object like any other PowerShell result, which plain nslookup text never allowed.
Caveat: it comes from the Windows DnsClient module, so a script that uses it is a Windows script. On a Mac or Linux box I’d use dig for the same job.
Further reading: Resolve-DnsName on Microsoft Learn