How do damage types affect HP?

Played my first game of D&D5e last weekend, and the DM kept referring to different damage types (Necrotic, Slashing, Bludgeoning, etc.).

Do these damage types affect HP differently, or do you just add up each damage type and subtract from the player character’s total HP?

Why specify the different types of damage? Thanks for your help!