At this layer we decide which service handles the data. The 16 bit port numbers identify a particular process on the source or destination host1. There are 64K (65,535) ports, limited by the size of the port field.
Traditionally ports 0-1023 are not usable by "normal users". These are called "priviledged" or "well-known" ports. The mapping between port names and numbers is done by /etc/services (%SYSTEMROOT%\system32\drivers\etc\services on Windows). The official list is here: http://www.iana.org/assignments/port-numbers.
TCP provides connections, channels that carry more than one packet. A TCP connection will deliver all the bytes sent, in order (or let the application know with an error message). There are fields in the TCP header to track the connection state, byte order, and to account for all the bytes sent.
UDP packets are unrelated to each other. They carry independent messages that fit in one packet. They may arrive in any order and there is no indication (to the sender) of whether they arrive or not.
UDP is faster for a program to use because it doesn't require opening a connection, but it requires additional work (e.g., timeouts to detect lost packets). TCP provides reliability where missing or misordered bytes would cause problems (e.g., file transfers). Size and longevity of the connection aren't significant considerations.
1 Actually programs deal with sockets, defined by address and port of both source and destination. So processes can share port numbers. But on a server, listening for data from an unknown source, only one process can listen to a port (for each address on the host).