There are 13 damage types in D&D 5e (source):
Acid. The corrosive spray of a black dragon’s breath and the dissolving enzymes secreted by a black pudding deal acid damage.The main difference between them is...
Bludgeoning. Blunt force attacks—hammers, falling, constriction, and the like—deal bludgeoning damage.
Cold. The infernal chill radiating from an ice devil’s spear and the frigid blast of a white dragon’s breath deal cold damage.
Fire. Red dragons breathe fire, and many spells conjure flames to deal fire damage.
Force. Force is pure magical energy focused into a damaging form. Most effects that deal force damage are spells, including magic missile and spiritual weapon.
Lightning. A lightning bolt spell and a blue dragon’s breath deal lightning damage.
Necrotic. Necrotic damage, dealt by certain undead and a spell such as chill touch, withers matter and even the soul.
Piercing. Puncturing and impaling attacks, including spears and monsters’ bites,
deal piercing damage.
Poison. Venomous stings and the toxic gas of a green dragon’s breath deal poison damage.
Psychic. Mental abilities such as a mind flayer’s psionic blast deal psychic damage.
Radiant. Radiant damage, dealt by a cleric’s flame strike spell or an angel’s smiting weapon, sears the flesh like fire and overloads the spirit with power.
Slashing. Swords, axes, and monsters’ claws deal slashing damage.
Thunder. A concussive burst of sound, such as the effect of the thunderwave spell, deals thunder damage.
Some creatures and objects are exceedingly difficult or unusually easy to hurt with certain types of damage.Bludgeoning damage, for example, is good against skeletons, as they are vulnerable to this type of damage. Fire elementals are IMMUNE to fire and poison damage, so they take NO damage at all from these sources.
If a creature or an object has resistance to a damage type, damage of that type is halved against it.
If a creature or an object has vulnerability to a damage type, damage of that type is doubled against it.
Gabriel Anhaia (from the Facebook community D&D 5E - RPG BRASIL) made an interesting compilation of various monster resistances are vulnerabilities across multiple books. I just added color and a subjective "grade" (from 0 to 10) to each damage type (click to enlarge):
This is all quite arbitrary and somewhat incomplete, but is it useful as a visualization tool.
Bear in mind that resistances, immunities and vulnerabilities are not common, which means they seldom apply. So, while 5 points of force damage are better than 5 points of poison damage, 6 points of poison damage may be better most of the time.
What is the best damage type? Probably the force, since no creature has resistance against it. Radiant and thunder are also very good.
What is the worst damage type? Certainly the poisonous. There is a lot of resistant creatures and even more that are completely immune.
What is the best type of weapon damage? Between slashing, piercing and bludgeoning, the latter is slightly better.
Note that "magic damage" is not a separate type of damage, but another classification, parallel to these 13 types. The damage of a magic weapon can be slashing, piercing and bludgeoning, something else (the Sunblade causes radiant damage, for example) or a combination (the Flame tongue causes slashing or piercing damage, plus fire damage).
Likewise, fire damage can come from a fire or a fireball, etc.
In addition, while resistance to slashing, piercing and bludgeoning damage from nonmagical weapons is somewhat common (as seem on the table), resistance to theses damages is very rare when they are caused by magical weapons. I would imagine magical weapons are almost on par with radiant and thunder.
What is this good for? Choosing your spells, features, etc... or creating your own!