Screen Time or parental controls on Mac OS or iOs make it possible to block YouTube on Safari. To enable this, go to Screen time settings, open Content and Privacy restrictions and add the web address of youtube.com to the Never Allow list and save. Third-party website blockers or router-level blocking can also be used in case you want it blocked in all the devices.