Firebase serve error: Port 5000 is not open. Could not start functions emulator

For Mac/Linux, use the Terminal/Shell to find the Process ID (PID), then kill the process.

sudo lsof -i :5000
sudo kill -9 PID

In MacOS Monterey, port 5000 may be claimed by a new "AirPlay Receiver". This can be disabled in Settings -> Sharing:

Screenshot of settings panel for disabling AirPlay Receiver

Disabling the AirPlay Receiver (if you do not need it) frees up port 5000.