It sounds like you've got the right idea, using distance and slowly moving closer over time. If your puppy is being reactive toward the other dog you're passing, you're too close.
But life doesn't always go as planned! On occasions where passing a dog that is coming toward you is unavoidable, like you said, staying confident and calm, but continuing forward at a brisk pace seemed to work pretty well for my puppy. Just keep at it, your puppy will calm down over time. Good Luck!
It's not the size of the dog in the fight, it's the size of the fight in the dog. Mark Twain