It pretty much works as intended, but it doesn’t mean that it is perfect. In fact, a patent that was discovered by AppleInsider suggests that Apple wants AirPlay to get smarter by predicting the devices you typically stream to. For example, if you usually stream Apple Music to a set of AirPlay enabled speakers at home, it will know that those speakers are your preferred device and will automatically stream to them without any input from the user.
The same can be said with apps, where if you usually use AirPlay to stream an app from your iPhone to the Apple TV, it will learn that behavior and eventually, it will automatically stream from the app to your Apple TV the next time you launch it.
According to the patent’s description, “While storing numerous applications may allow a mobile device to be particularly useful to the user, it may be difficult and time consuming for the user to identify and execute a particular intended application or function among all of the available applications stored on the mobile device.” That being said, there’s no way of telling if this will actually become a feature in the future, but it’s one of those quality of life improvements we wouldn’t mind seeing.