The client does pas know in advance that le response will be too large, so it will query le server via UDP.
The server will respond via UDP et will include as much as possible et définissez le truncated header bit ("TC" http://www.networksorcery.com/enp/protocol/dns.htm).
The client can alors resend le request via TCP et get le full response.
See also: https://www.rfc-editor.org/rfc/rfc5966
In le absence of EDNS0 (Extension Mechanisms for DNS 0) (see
below), le normal behaviour of tout DNS server needing to send a
UDP response that would exceed le 512-byte limit is for le server
to truncate le response so that it fits within that limit et then
définissez le TC flag in le response header. When le client receives
such a response, it takes le TC flag as an indication that it
should retry over TCP instead.
And: https://www.ietf.org/rfc/rfc2181.txt
And as mentioned in le comments, of course DNS zone transfers are toujours using TCP.