Don't you just hate when you prepare a bunch of amazing spells, only to see they're not as effective as they normally are against the monster you're fighting against? Dungeons & Dragons offers a plethora of creatures for the players to face, and that's not to mention the weird creativity your DM may possess, increasing this roster substantially.
One way these creatures can withstand fighting an entire party of adventurers is the ability to resist certain attacks. Thus, when creating your character, here are some attack types you should consider avoiding because of damage resistance. Not to mention damage immunity, which will also be tackled here.
10 Piercing
Starting with our spear combatants, a few enemies are resistant to piercing damage. With that said, the number of creatures is ridiculously low, and the only reason this type of attack even made the cut is simply that there are a couple more enemies with resistance to it compared to other weapons.
Still, considering the amount is pretty low, piercing weapons are quite viable when fighting. You can also use something like Polearm Master to attack with the other end of the weapon, which counts as a bludgeoning attack, thus avoiding enemy resistance. This attack will only be a d4 though, but hey, an extra attack never hurts. Actually, it does, but you get it.
9 Psychic
All cards on the table, only one creature is resistant to psychic damage (hello, Revenant). But there are a few who are immune to it, which isn't a good thing. Quite the opposite — it's worse. However, psychic damage usually comes from powerful spells, so worrying about resistance and immunity is not something you'll do a lot.
The cool thing about psychic damage is that it often comes with a nasty side effect, meaning that not only will you hurt someone with it, but you'll also give them some negative effects they'll have to deal with during the fight.
8 Thunder
You better run, you better take cover. Which may not work since Shatter also destroys cover. Regardless, few creatures are resistant to this type of damage, and even fewer are immune to it, making it an excellent choice on the battlefield.
Many powerful spells use this type of damage too, making it a solid choice for spellcasters. You'll be able to safely use it in most situations without having to worry about damage resistance except for specific creatures or homebrew monsters that your DM has created to kill you in particular.
7 Necrotic
If you want to be evil, think again. Or don't, since this is a powerful damage type, actually. It even has fewer resistances compared to the aforementioned thunder damage. But necrotic damage has more immunities compared to thunder, making things a bit harder here.
Regardless, this can be a very effective method of killing your enemies, and you can keep your powerful Edgy Lord style while doing it. Besides, the total number of resistances and immunities is still pretty low here, making necrotic an effective choice.
6 Acid
Splashing some acid into your foes is quite the trick, and not many creatures can do something about it. There are resistant and immune creatures to this type of damage, but there aren't many around there, making acid a viable option.
The biggest problem with acid is that you don't have a lot of spells that cause this type of damage either. However, you can still build your character around it, and its corrosive spells can even be useful to circumvent puzzles by destroying things as well as enemies. Or you can break stuff with Thunder damage too.
5 Lightning
Now we're finally getting into the "considerable amount of enemies with resistance" territory. Though having a Thor-like character can be very exciting, this is an element with a decent number of creatures resistant to it, and a few also immune to it. There are ways around that, but it is important to be aware of.
Still, a character with many lightning attacks usually has thunder damage too, which can help you bypass some resistances. Your Tempest Domain Cleric will still be pretty powerful, so don't worry about it.
4 Cold
The cold never bothered them anyway. Of all the elemental types, most creatures are resistant to this one, with a decent number being immune too. If cold damage is that relevant for your character, you should consider adding the Elemental Adept feat into your build, so you can ignore cold resistance at least.
You can also use it to fix most of the elemental types mentioned here, but remember, you can only get Elemental Adept once. For the Sorcerers out there, Tasha's Cauldron of Everything has an extra Metamagic option called Transmuted Spell, which allows you to spend a Metamagic point to change the spell's element, thus adapting your element to the moment.
3 Fire
Being a firebender pyromancer can be quite a challenge. There are fewer creatures resistant to it compared to cold, but the number is still pretty high. What makes it worse than cold damage, however, is the unfortunately high number of creatures that are immune to fire damage, rendering all your Fireballs useless.
You can also circumvent the problems here with the tips above, but keep in mind you can only choose one element to bypass resistances with Elemental Adept, and it won't bypass immunities, which can still render your fiery attacks useless.
2 Non-Magical Attacks
If possible, it's best to magically enhance your weapons as soon as possible. Many creatures are resistant to attacks from non-magical sources, and a few of them are also immune, meaning there's only so much you can do with a regular sword.
These creatures will likely not appear during low levels missions, but they may become more common when you reach high levels, so you have time to prepare yourself with some magical weapons.
1 Poison
Poison is likely the most ineffective type of damage, sadly. Though very few creatures are resistant to it, a lot of them are straight-up immune to poison, which is even worse than the resistance part. This means your poison attacks will not even tickle the enemy.
Though this isn't always the case: the best tip is that most creatures immune to poison are, you know, actual creatures. If you're fighting Humans or Human-like opponents, it might work. Still, some species are resistant to poison, such as Dwarves, or the Yuan-Ti, who are actually immune (and playable!).