Behavioral science suggests that punishment is the worst way of teaching any human to behave. Even just ignoring bad behavior is better.
What works best is ignoring bad behavior and rewarding good one randomly (so not every time).
And I would warn against overly relying on food as a form of reward and punishment, unless you want to give your kid an eating disorder for the rest of their life.