I downloaded VLC to play videos on my tablet a couple of years ago. It continues to play audio when I switch to a different app in the foreground or power the screen off to prevent me from accidentally touching it and causing some unwanted action.
Under preferences, the choices are Stop, Play videos in background, Play videos in picture-in-picture mode.
My default Samsung video player also has a setting to allow you to play audio in the background.
I only use them to play videos I've downloaded from my PC, but I think you could probably configure VLC to play YouTube.
Since someone mentioned YouTube Red, it has been rebranded as YouTube Premium and just launched in Canada.