The TCP/IP and UDP/IP protocols know a "session" which is defined by local and remote IP address and port [1]. A TCP/IP package, for example, will contain source and target IP address and port [2]. A server or client (say, Firefox) which has more than one connection open will distinguish at the OSI [3] session layer by address and port.
Please open a shell and run as root, while using a web browser
netstat -tulpan
to see current and active connections [4].
Example output:
# netstat -tulpan
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1966/sshd
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 1902/cupsd
tcp 0 0 192.168.1.16:57374 172.217.23.165:443 ESTABLISHED 4730/firefox-bin
tcp 0 0 192.168.1.16:55478 104.26.11.30:443 ESTABLISHED 4730/firefox-bin
udp 0 0 127.0.0.1:53 0.0.0.0:* 1996/named
The lines show "ESTABLISHED" connections by firefox with differing local ports so that firefox will recognise which packet is the answer to which request.
Other lines with the LISTEN state are local programs running as a server process, including sshd (Secure Shell Server), cupsd (printer daemon) and named (Bind name server). These will accept incoming connections.
References to learn more:
[1] https://en.wikipedia.org/wiki/Port_(computer_networking)
[2] https://en.wikipedia.org/wiki/Transmission_Control_Protocol#TCP_segment_structure as well as https://en.wikipedia.org/wiki/IPv4_header#Header
[3] https://en.wikipedia.org/wiki/OSI_model
[4] https://en.wikipedia.org/wiki/Netstat
netstat -tulpanto see current connections while having a web browser open to see examples.