TCP and UDP are the internet's two core transport-layer protocols. TCP is connection-oriented with reliability and ordering; UDP is connectionless with minimal overhead for speed.
The trade-off is: TCP is 'accurate but heavy,' UDP is 'lightweight but offers no guarantees.'
TCP establishes a connection via a 3-way handshake and uses sequence numbers, acknowledgments, and retransmission to ensure data arrives without loss or reordering, with congestion control adapting to network conditions. Those reliability mechanisms add latency and overhead, and the ordering guarantee is the root of Head-of-Line blocking. It's used where correctness matters — the web (HTTP/1.1 and 2), email, file transfer.
UDP fires datagrams off without a handshake. It doesn't take responsibility for loss, duplication, or reordering, but in return it's low-latency and lightweight — ideal for live streaming, games, VoIP, and DNS lookups where 'fast even if a little is lost' beats perfect delivery. Notably, QUIC reimplements reliability, ordering, and encryption per stream atop UDP's lightness, capturing TCP's benefits while sidestepping its limits (HoL blocking, slow evolution).