Playing soldier for a change, I feel a little better to say what I found.
Pyros are easy,
as long as they don't get the jump on you. If they do, try to remain calm, and rocket jump. The splash damage may kill the pyro, if not, fire another from your advantageous aerial position. You're likely to perish from falling/ afterburn damage, but that's what you get if a pyro ambushes you. Avoid it.
If he's running up to you, aim at their feet. If aimed correctly, he'll fly up, not back. Practice and trial and error allows you to find this spoy. Use this time to lay another rocket down in quick succession, fragging him. If he flies back- so what? He's no longer a threat, as pyros need to draw in close to you, requiring them to walk into your kill zone, close to mid range. Continue on, and kill him if he dares cross your path again.
Demos are a real threat. Their splash damage is deadly, and their stickies hurt. Plus they excel at the same range as you, without the damage falloff and are the best at indirect shelling. If you can, ambush them, especially if one is blocking a vital chokepoint. Use height to your advantage, even if it's just a slightly higher ledge. Go for pyro killing tactics, but take extra care- pipes hurt. See one incoming? Dodge. See stickies? Get in close to him, dodging what you can. Don't underestimate stickies- never try to cross them when a demo is present. If one sticky is visible, bet your bottom dollar another 7 await you. Play smart. Play safe. Play to pwn.
This makes an interesting read on demos vs soldiers