When does DNS use TCP instead of UDP?

IntermediateConceptDNS
Answer

UDP/53 is the default for small queries and answers. TCP/53 is used when the response exceeds the size limit and is flagged truncated (TC bit), for zone transfers (AXFR/IXFR), and with DNSSEC or large TXT answers. EDNS0 raises the UDP size to about 1232 bytes to reduce truncation.

Firewalls that allow only 53/udp cause intermittent failures for large responses; allow both.

All Networking questions Roadmap: Networking for DevOps

More on DNS