Might not be related, though. When 'casting' to YouTube, your phone isn't actually sending anything to Chromecast. Chromecast just receives the 'command' to load the YouTube app and it streams the content, leaving your phone to act just as a remote control, nothing more.
With screen mirroring, you can have TWO streams of data: One to stream the content to your phone (movie, webpage, etc.) and one to stream your screen content to your device (Chromecast, TV, etc.). This, of course, puts extra-stress on the processor for the phone that now needs to do two heavy tasks at once. Also, it uses more bandwidth from your router to do so.