I captured a video to show the behavior (follow the link above; this shows it failing on my iPhone and working on my iPad)
This has been a problem for several versions of iOS13 now (strangely it works fine on iPadOS), and it is driving me insane. I tend to cast video from YouTube to my AppleTV pretty frequently, and this is making it extremely frustrating. I've tried it on my wife's iPhone as well, and it has the same problem, so I know it's not just me.
Basically, some of the time, when you hit the cast button, the control center controls that pop up won't show that YouTube is playing. It just shows music controls instead, which means you can't select an Airplay destination for YouTube. Similarly, if you are playing a video from YouTube, if you pull down the notification center, the playback controls won't show that YouTube is playing either. It seems that iOS doesn't see YouTube when it's playing media.
But to make things more annoying, sometimes it does work. Sometimes it works several times in a row, until I switch back and forth between Music and some other apps, and then at some point it just stops working again. There seems to be no rhyme or reason to it, or any correlation to some other app that may be causing it to hang up.