How to flush the DNS cache on macOS?
mDNSResponder is started by launchd whenever a DNS query is performed in the system. So it will restart the next time some process performs a DNS query.
Killing this process is not required though, sending the HUP signal with
sudo killall -HUP mDNSResponder
already flushes the cache. This hasn't change up to 10.15.
dscacheutil is only for 10.6 and you need a different command from 10.10.0 to 10.10.3, that's because Apple wanted to replace mDNSResponder with 10.10, yet the replacement had so many problems that they reverted back in 10.10.4 and stayed with  mDNSResponder ever since.