The command you will need to run in Terminal is shown below. This will work for OSX catalina and higher.
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder