As said before, let's not think too much about how realistic things are in D&D. Cause they aren't realistic at all. Handheld weapons are bad choice for fighting anything larger than large humanoid creatures. Huge and gargantuan creatures are so big, you can't reach any vital parts at all, and even if you can reach it, you need to go trough some thick hide, muscle and fat to get deep enough to hit vital part.
In short, for anything above large - siege weapons, artillery, magic. T Rex, example for Huge creature, is 13 meters in lenght, 4 meters tall at hips, and weights 8-10 metric tons. In comparison, largest elephants are 4m at shoulder and weight around 6 metric tons. Old dragons would be closer to C130 in size (lenght, mass, wingspan), but with scales comparable to main battle tank armor. So yeah, rapiers. Right