The Transport Layer (Layer 4) is responsible for process-to-process delivery. While the Network Layer (IP) gets the packet to the correct destination computer, the Transport Layer ensures the data gets to the correct application program on that computer using Port Numbers.
There are two primary protocols at the transport layer: TCP (reliable) and UDP (unreliable).
User Datagram Protocol (UDP) is a connectionless, unreliable transport protocol. It provides the absolute bare minimum functionality required to deliver a payload from an application on one machine to an application on another.
Because it provides virtually no features, the UDP header is incredibly small and simple. It consists of exactly 8 bytes (compared to TCP's 20-60 bytes).
The header contains only 4 fields (2 bytes each):
If UDP is unreliable and loses data, why would anyone ever use it?
Because it lacks the massive overhead of handshakes, sequence numbers, and acknowledgments, UDP is blazing fast. It is used in scenarios where high-speed delivery is vastly more important than perfect accuracy.
google.com, your browser needs to quickly ask a DNS server for the IP address. This is a tiny, single-packet request. Setting up a heavy, 3-way TCP handshake just to ask one quick question is horribly inefficient. UDP is used instead. If the request is lost, the browser just asks again a second later.