"He's friendly," you say, just as your dog plants two muddy paws on someone's coat. It may be excitement, but don't assume every jump means hello. A dog can also jump when worried or frustrated. Either way, the other person did not sign up for a greeting.
Keep your dog on a secure lead, leave enough space, and say "We're training, please don't come over" before someone approaches. If your dog cannot keep their paws down, skip the hello. That protects strangers and stops the jump from becoming the most practiced part of a walk.
Practice before the greeting
Start with an easy scene: a friend standing at a distance. Reward your dog for noticing them and keeping four paws on the ground. Walk closer only if your dog remains loose and able to respond, move away if they start to surge forward. Ask the friend to wait rather than reaching over the dog or offering food in a way that pulls a worried dog closer.
Build a simple alternative away from people first, such as looking at you, standing beside you, or searching for a few treats on the ground. Use it before the jump, not after several leaps. If your dog is too excited to respond, add more distance and try a shorter session another day.
Don't make every calm approach end in a greeting. Sometimes reward your dog and walk on. This teaches that seeing a person doesn't always mean rushing up to them. For a dog showing stiff posture, growling, or fear around strangers, stop practicing close greetings and seek a veterinary check and qualified behavior help. No amount of "sit" should put someone at risk.
The best greeting is one the person and the dog both have room to decline. For more on passing people without pulling into a greeting, see the loose-leash walking guide, a stranger's consent is part of the plan
Sources: Dogs Trust: How to stop your dog jumping up at people. Battersea: How to deal with your dog's stranger issues.