You have to first do a dopamine detox...you mention YouTube but it's usually a lot more than that. You probably addicted to a lot of other stuff (like porn, food, sugar, TikTok). You need to give your brain a break from the over stimulation.
what does this look like? get rid of all your electronics except what is essential. for me this is just my phone, kindle and laptop. as soon as I get home my phone goes in an electronic time lock box and its locked until next morning. on my laptop everything is blocked like YouTube and only the stuff essential is available (I'm on my Mac I use an app called SelfControl). get rid of your junk food and eat wholesome home made meals. replace YouTube with other interests you have always wanted to do preferably something that doesn't require electronics like drawing or reading or playing an instrument
After 30-60 days you feel a lot better and more at peace with yourself. at this point you have a decision to make, can I go back to where and keep it under control or do I need to make this the rest of my life. for me I chose an analog life and I avoid electronics as much as possible. I use instagram and YouTube but I have iOS timers on them so it's blocked after my allowed time runs out.