If an experienced killer on the street want to kill you with a knife, you're pretty much done for. If an experienced killer on the street want to kill you with a a gun, you're done for.
Up close, a knife is extremely hard to defend against -- and that's assuming you see it coming. No matter what, you
will get cut, possibly fatally (the trick is to get cut as little as possible

). This goes for pretty much everyone, even those trained in defence against knives. If this person knows what they're doing, they can get far enough away from you before people realise exactly what happened (unless they get you alone, in which case there's not even that).
Up close, a gun is extremely hard to defend against if you don't see it coming. It's easier to spot with a knife, and you have a better chance of knocking it away, but if the attacker hides it well enough you won't get the chance. Assuming the gun is concealed reasonably well, those around you will take a minute to figure out where it came from, by which time your killer can be our of there. That's assuming they get up close.
From a small distance, you can run away from a knife if you see it coming. If you don't, see above.
From a small distance, you can run away from a gun if you see it coming, and with luck you may even avoid a fatal shot. If you don't, though, you'll never know what hit you and it'll be even easier for your killer to escape.
Up close, for either weapon, or small distances for a gun, you're not going to get much of a chance to pull your own if the other has their ready to go. Could
you draw a pistol, aim, and fire in the time it takes to pull a trigger? Could you pull a knife in the time it takes to slap someone (which is about the same as a knife slash)? Could you do either of these if you were taken by surprise?
From a long distance, your chances of realising someone has a knife are close to none, and there is no threat to you.
From a long distance, your chances of realising someone has a gun are pretty low, and close to none if they're in a concealed position. With a rifle, they can shoot you dead just fine without getting anywhere near you, and be out of there long before they're located.
And another important factor is the difficulty of pulling the trigger when a human is in your sights. Militaries spend a lot of time getting their people to a point where they can shoot first and get hit with emotions later. Your average gun owner hasn't had any of that. It's one thing to hypothesise shooting a human, quite another to be in that position in real life.
In summary, saying "If you have a gun, you're less likely to die" is a gross simplification. Of course, saying "If we ban guns completely, there will be less gun-related crime" is also quite a simplification.