I get depressed often, usually due to dysphoria, and I usually massively over eat. I see what you mean.
With dysphoria and other 'illnesses' that you are more susceptible to developing because of your dysphoria, relationships with food aren't always uncommon. I know lots of guys that comfort eat, myself being one of them.
When I was younger and not out, I had around 3 months of eating every 2-3 days and bingeing on food often. I lost a ton of weight, but I also has no energy, felt faint and I began throwing up when exercising.
It's difficult to find a healthy middle - I've yo-yo'd between healthy, overweight and slightly underweight for years - you just need to concentrate on getting right right amounts of food, and if you're overeating maybe try go out for a walk - I ate a ton the other day and went on an 8 mile hike, which made me feel better about the food but also cleared my mind.