Limit who can AirPlay to an Apple TV 4K
Use Apple TV’s AirPlay access settings to choose the right audience and require a password if your shared network needs it.

Choose who should see the receiver
Open Apple TV settings and find AirPlay and Apple Home. Apple lists choices such as anyone on the same network and people sharing the home, depending on the setup. Select the group that matches how you use the television. On a shared or guest network, review whether you want a password or a narrower audience before allowing an AirPlay session.
Test a known sender
From your own device, send a personal clip and check what access prompt appears. Enter codes on the device you control and keep them out of screenshots. If a household device no longer finds the receiver after you narrow access, check whether it shares the expected network or Apple Home. Use the Apple TV remote to revise access. A casting app cannot change who the receiver is allowed to accept.