I have a 5 month filly at home. When I feed, is when I do my "messing around" with her, rub her all over, pick up her hooves, feel all over to get her use to me touching wherever I want. When I lead her, a couple of times, she's tried to rear and paw, then kick me, like she does her mom, I bopped her, told her no, pulled her head back down. Hasn't done it since. Once since, she has tried to head but me with her muzzle to get me to leave her alone, when I was putting her in the horse trailer, I bopped her on the nose. She hasn't done it since. I praise every positive, punish every negative. Was getting a bit mouthy, nibbling, just one bop on the nose, doesn't have to be hard. she stopped.
I am no way a trained trainer, just have had horses my 51 yrs, and quite a few foals, I've done them all the same and they grew to adulthood with no problems (or as problem free as a horse can be! lol) .