What are ports?
When two hosts communicate over IP, the operating system must deliver each packet to the correct application. Port numbers identify that application endpoint. A web server listening on port 443 receives HTTPS traffic; SSH listens on port 22.
Ports 0–1023 are well-known and assigned by IANA. Ports 1024–49151 are registered for specific services. Ports 49152–65535 are dynamic/ephemeral - browsers and clients use these temporarily.