You can run YouTube videos in the PC without any problem but when you listen to music in Phones you may find that you can just listen to it with the phone locked or open any other view. YouTube has to be on your screen all the time otherwise the video would get paused ?
All you need to do is to install Firefox in your Android. Open the browser and go to YouTube. Open any video then click on the top right dot icons to open the option menu. From the option menu, check Request Desktop Site option. There you go, now you will be able to go back by clicking on the home icon without getting the video paused.
Also if you want to stop ads from playing you can type “uBlock for firefox” on search, and click the extension for Firefox browser. After installing it will stop ads from playing.