Hmm, it is possible the isp dns is down.
Then you won’t be able to resolve domain names, this is quite common with network issues, you could set a different dns as long pinging to ips work, if not it will fail, then the isp is down likely.
or the main connection line has issues, like with fiber a unclean fiber optic could be a issue, but then you often notice more issues and unstable internet.
if the issue is only dns, you may not want to use DoT or DoH first since often these services use a domain name first, and I don’t know how it uses it in those gl scripts, first you want a working dns and then apply DoH or DoT, just in case, it might just work but I haven’t checked it.
It could be IPV6, imo it has alot of adoption problems, could be also on the isp side.
It would be something on your own network, if full dhcp loses, then you may want to investigate for turning down dhcp rebind protection if there is a second router, a ip conflict, or a weak PoE accesspoint/switch reaching its max.
I had two situations with unifi switches, sometimes they can claim a low segment ip when the AP is there, it can give very unexpected and slow network results, since a switch is also layer 2 you sometimes don’t necessary see the issue by forehand funny enough you can even receive vlans and not being able to access the switch ui (appearing offline), having a sudden disconnect and then working again.
And I had a maxed PoE connection, it was to low power left, but enough to keep my ap running with no uptime lost, only the wifi stops working when speedtesting.
These are things to look out for if the more normal things above are not happening.