UDP uses a concept called as "pseudo header". Pseudo header helps to find transfer bit errors and also to protect against other types of network errors like the possibility of IP datagram reaching a wrong host.
Below image contains the UDP header format.
Checksum value is calculated after prepending a pseudo header to actual UDP header and data. "Pseudo header" has many fields from IP header also.
The Pseudo header has Source and Destination IP addresses, an 8-bit reserved field containing all 0s, an 8-bit protocol ID (17 for UDP) and the 16-bit UDP Total length field, as shown in above image. Source and Destination IP addresses contains the Source and Destination IPv4 addresses of IPv4 header, Protocol field contains the IPv4 protocol type code (17 for UDP), Total Length field contains the length of the UDP datagram (excluding the pseudo header).
UDP prepends the pseudo header to UDP datagram, and computes the checksum for pseudo header, UDP header and data. The checksum value is then inserted to the Checksum field of UDP header. Pseudo header is used only for calculating the checksum value. It is not a part of actual UDP packet and it is never sent over network.