This guide is for macOS Monterey. Check this page for macOS Ventura.
2025.09.22 Update: In macOS Tahoe, you can find AirPlay Receiver toggle in System Settings › AirDrop & Handoff.
As is port 3000, port 5000 is commonly used to serve local development servers. When updating to the latest macOS operating system, I noticed my React development server, which I'm serving with React create-serve was using a port other than 5000, because it was already in use. (You may find a message along the lines of Port 5000 already in use.)
By running lsof -i :5000, I found out the process using the port was named ControlCenter, which is a native macOS application. If this happens to you, even if you use brute force (and kill) the application, it will restart itself. In my laptop, lsof -i :5000 returns that Control Center is being used by process id 433. I could do killall -p 433, but macOS keeps restarting the process.
The process running on this port turns out to be an AirPlay server. You can deactivate it in System Preferences › Sharing and uncheck AirPlay Receiver to release port 5000.
As an aside, I just ran into this same issue when trying to run a Node.js server application as of September 13, 2022.
uncaught exception: listen EADDRINUSE: address already in use :::5000
Error: listen EADDRINUSE: address already in use :::5000
If you found this useful, let me know!