Open firefox and type:

about:config

Search for:

network.trr.uri

Probably you already have:

https://mozilla.cloudflare-dns.com/dns-query

If not add it or use something like:

https://cloudflare-dns.com/dns-query
https://dns.quad9.net/dns-query

Then enable network.trr.mode by setting it to 2

Set network.trr.mode to 2 make DNS Over HTTPS the browser's first choice but use regular DNS as a fallback (0 is "off by default", 1 lets Firefox pick whichever is faster, 3 for TRR only mode, 5 to explicitly turn it off).