Some people are moderators, some are abstainers. My other half can just decide not to eat chocolate or cake and will stop completely. I struggle to moderate myself. Like the op with drink, if there is an (open) bar of chocolate in the house I'm not satisfied until it's gone.
If you are someone like me, who has tried for years to moderate themselves, the answer will always be that you are better off abstaining altogether or setting rules for when you can eat or drink.
If you don't want to give something up completely, 'If ... then..' is a good system. eg.
If I'm at the cinema, then I can eat chocolate.
If I'm at a party, then I can have a drink.
If I'm on a bike ride, then I can have cake.
If you can moderate yourself but want to cut back, counting down instead of up can work. ie. your limit is say 3 drinks, so count down - 3, 2, 1, instead of up to 3. Psychologically, it's easier to say 'Just one more won't hurt...' than to have another one once you've used up your 'allocation' for the night.
Lots of good tips on building habits in James Clear's book 'Atomic Habits', and Gretchen Rubin's 'Better Then Before'. Easy to find out what to do, but hard to make it stick though.