How to query macOS DNS resolver from Terminal?

It seems taking the effort to formulate the question I understood the problem better to perform more precise google searches and found the answer.

On macOS querying DNS is achieved by:

$ dscacheutil -q host -a name example.com
name: example.com
ipv6_address: 2606:2800:220:1:248:1893:25c8:1946

name: example.com
ip_address: 93.184.216.34

Like most macOS shell commands it is not quite as nice as the unix equivalent, but it gives me consistent results with native mac apps.

I found this from https://random.ac/cess/2018/04/12/macos-dig-vs-dscacheutil-while-using-split-dns-with-viscosity-vpn-client/