This is the best feature of the Sandvich!
It works exactly like a health pack. It's great to be able to give a Medic your Sandwich, since he does not have a quick way to self heal.
The Sandvich will regenerate after a cooldown, or can be instantly recharged by visiting a Resupply cabinet, picking up your own thrown Sandvich, or collecting any health pickup while at full health.
Do note that you cannot replenish health by dropping your own Sandvich and walking over it, you will simply pick it up again. You can however pick up another Heavy's dropped Sandvich, which will restore health as per normal.
Just be careful the enemy can't get to it first: It can also heal them.
Certain classes are better against certain other classes.
In general:
Heavy is weak against Spy, Sniper, and Demoman.
Heavy is strong against Scout, Pyro, and Medic.
Heavy is even (more or less) against Soldier.
An Engineer versus Heavy depends entirely on if the Engy has a level 2-3 sentry or not. A mini-sentry or level 1 sentry will almost always see the Heavy win at full health. In this case, the Engineer should flee. If he was building mini-sentries, building them as you flee is an excellent idea, as it will slow the Heavy down to kill it, or make him ignore it to chase you, dealing him damage all the while.
Medic is weak against Scout, Pyro, and Soldier... well, most of the classes in the game, but those three in particular.
Medic is strong against the Spy, simply because a Medic that continually moves will generally outrun or dodge a Spy's backstab.
The thing is... a Scout has the best chance of killing a Medic if he can manage to get behind the Medic, simply because a medic is a 2-shot kill with the standard Scattergun at close range.
Now, the best defense against a Heavy/Medic pair is to work with your own teammates. If you can take out one of the two, the other teammates may be able to take out the other.
If you really do need to combat them alone, Sniper is likely your best bet. As tempting as it is to go after the Medic first, if he keeps moving, he can generally outrun your scope. However, a fully charged headshot will one-shot the Heavy.
If they Uber, run, unless you're an Engineer trying to keep a sentry nest up. In this case, repair repair repair, and hope that they aren't smart enough to have the Medic block the sentry's knockback effect. If you can get a Pyro to help you by airblasting the Medic or Heavy away, even better.
P.S. NEVER go head-to-head versus a Heavy, he will always likely win simply because of how much damage he does.
Best Answer
You need a shotgun when you can't use you primary weapon because it's either slow or slows you down. This can happen in several situations:
The sandvich is a great thing, but it won't help you when you are out of ammo or if you need to fight in tight spots. I usually run with the sandvich, but I can't deny that shotgun is very helpful in some cases.