It's terribly frustrating to have watched parts of a Youtube video, then have iOS quit it. Unless I wrote down the time-stamp, I would have no idea where I left off. Is there a way to stop iOS from ending apps when idling? Thank you!
iOS automatically quits apps which haven't been used for some time, especially if available memory required for the active apps runs low. There is no setting to disable that (which probably wouldn't be a good idea anyway as it would block other apps from getting loaded/started).
But usually apps get notified before they get unloaded and are supposed to store their current state (including for instance the playback position for YouTube) so they can restore it when you switch back to them/restart them. If you need advice on how to make this work for you when using YouTube, please ask a new question (and include the details others asked for in the comments).