Both UDP and TCP are designed for sending and transmitting information.
TCP is focused on efficient and reliable data transfers. The TCP protocol establishes a session through handshakes to deliver data successfully. If data packets fail to transfer successfully, they are sent again. TCP will also use packet sequencing, which breaks large volumes of data up into smaller units to ensure that information is sent successfully, receiving confirmation before moving to the next packet.
Also: The best web hosting services
UDP, however, doesn't stop for confirmation while sending data, nor will it necessarily resend lost packets. The trade-off for a lack of error monitoring is a gain in speed -- with some information potentially lost in the process.
While TCP requires handshakes between machines and there is delay tolerance, UDP is known as a "fire and forget" protocol. As Red Hat explains:
TCP requires a lot of back-and-forth data exchange between sender and target to establish a network connection. Then, even after the connection is established, there's more back and forth because TCP requires that the sender receive an acknowledgment from the target every time a data packet is sent.
This back-and-forth eats up time. UDP has no back-and-forth connection handshake.
In other words, TCP focuses on reliable, accurate data transmission, with speed as a trade-off. UDP does the opposite and prioritizes speed, and does not provide a guarantee for packet ordering or transmission. UDP may also be more susceptible to Distributed Denial-of-Service (DDoS) attacks.
Also: Flipper Zero: Geeky toy or serious security tool?
While the IETF has now proposed a standard for HTTP/3 over QUIC as a new protocol that can potentially balance both concepts, UDP and TCP are still very much in use worldwide.