the port field in a TCP or UDP packet is 16 bits. 2^16 is 65536, so the maximum port number is 65535.
The UDP header is 8 bytes. Here's how it's laid out. According to the RFC, the source port is optional but the destination port is required..
<- 16 bits -> +-+-+-+-+-+-+-+-+--+-+-+-+-+-+-+-+- | source port | dest port | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | length | checksum | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
the length field on a UDP packet is 16 bits, so the maximum length is 65535
you can put any bytes you want in a UDP packet. You could even put a very short mp3 file!
if you want that, you'll need to implement that yourself
even if they're sent inside the same computer, packets can still get dropped (for example if a buffer gets full)
If you want to implement retries on top of UDP, you have to do it yourself. TCP packets do get retried by your operating system's TCP implementation.
UDP & TCP both support the same port numbers (1-65535) but they're different protocols. You can run 2 different servers on UDP port 80 and TCP port 80 at the same time.
DNS is a big one!
Some other examples: DHCP, QUIC, NTP, statsd, a lot of
videoconferencing protocols and lots more.