I have confirmed that the DNS issue is caused by Avast. I am personally using Avast Internet Security version 18.6.2344 (build 18.6.3946.0) on Windows 10 version 1803 build 17134.191 (10.0.17134.191).
After clicking Avast shields control > Disable permanently, the issue was immediately resolved. I was able to toggle all Avast Shield on again without encountering the issue. Why the issue sometime occurs, I don't know...
By analyzing network traffic in detail with WinPcap and Wireshark, I have determined that the issue lies in Sending the DNS queries, not in reciving the responses. DNS queries fail(no trace of them) to send to the DNS servers. Ping works fine.
I have attached all of my logs from Avast:
https://www.dropbox.com/s/moat1drytlswcfo/avastdnsissuelogs_18.6.2344.zip?dl=1I will try to disable Real Site and Web Shield respectively the next time the issue occurs to find out if those components could be causing this.
Update: Disabling Web Shield wasn't enough. But when I also disabled Real Site, the issue was resolved.