The Pi 3 doesn't have HEVC hardware decoding, but the 4 does.
If you download your youtube videos beforehand using youtube-dl and play using omxplayer, the result is virtually glitch free.
A better option is to install the YouTube extension on top of Kodi on Raspbian. You might also need to disable the new OpenGL driver as well. Once that is done, Kodi (which has Pi GPU patches in place) can play YouTube at 1080p30 beautifully.
Yup, that was how I watched Youtube videos for years (although Kodi was on LibreElec). Now unfortunately all Kodi extensions using Google APIs require registration, which of course is a huge privacy violation since I'm (still) not forced to do that on browsers.