This is quite a heavy topic but I'm really glad you are aware of what you are doing and what it may be leading to. Honestly, I'm no doctor or psychologist so it's really not my place to give you any advice but I genuinely wish that you would speak to your doctor. I am not sure how old you are, but I don't think it matters all that much either way, but this can lead to serious health implications in the future. You may also be putting your life in danger. I think if you feel uncomfortable going with a parent (if you're underage), then make an appointment with a doctor who lives far away from your home and go alone. But definitely see someone.
Also as someone who has somewhat of an experience with eating disorders and weight
such a long story and not one I want to share right at this moment, I definitely suggest seeing a nutritionist. They will help you figure out what types of foods to eat for a healthy and balanced lifestyle and what types of foods to avoid. You should working on building a healthy and happy relationship with food.
But one thing I always think about whenever I have crazy thoughts about food is:
Food is my friend. It's fuel for my body and without it I won't be able to function. Knowing what to eat is obviously important though so definitely see a nutritionist.
I feel like I'm lecturing now but definitely speak to someone.
Please don't think of it as anything embarrassing because it's really not. I really hope you can overcome this.