How to flush the DNS cache on macOS? I've read that sudo killall -HUP mDNSResponder;sudo killall mDNSResponderHelper;sudo dscacheutil -flushcache should flush the DNS cache on OSX (macOS Mojave).

However, this command kills processes without restarting them, and is both hard to remember and cumbersome. Also, AFAIK dscacheutil applies only to the directory service.

Doesn't OSX provide a command like Windows' ipconfig /flushdns to flush the system's DNS cache?
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.