macOS does not have a dedicated flush command for its DNS cache. The cache lives in mDNSResponder, and you ask that process to drop it.
This needs sudo:
sudo killall -HUP mDNSResponder
The SS64 page for dscacheutil lists exactly this for macOS 10.10.4 and above and says the mDNSResponder restarts automatically, so the signal makes it reload and drop its answers. For older versions it lists sudo dscacheutil -flushcache instead. The man page for that command warns that the flush should only be used in extreme cases. On a current Mac the killall line is the one to use.
I only reach for it after a DNS change that should have taken effect and has not. First check with dig that the new record is live on your resolver:
dig example.com +short
If dig shows the new address and the browser still goes to the old one, a cache on the Mac or in the app is the likely cause. If dig shows the old address too, the cache sits upstream, in the resolver or at your router, and flushing the Mac changes nothing.
The caveat: browsers keep their own DNS caches, so a flush on the Mac does not always change what the browser does. Restarting the browser is the quick test. SS64 also remarks that normally there is no need to flush DNS entries, so this is a fix for a stale answer and not a routine step.
Further reading: dscacheutil on ss64