David says wicked people who draw the sword to kill poor innocent people will be killed with their own swords. And Jesus says all who draw the sword will die by the sword. So you don’t even have to be wicked, or kill innocent people, or even kill anyone at all. If you draw the sword, you will be killed with a sword.
Of course, Jesus was wrong, as usual. He was talking to Peter, who had just drawn his sword and injured an innocent person, yet Peter did not die by the sword. Apparently he died by crucifixion. The Bible doesn’t actually say how Peter died, but it does have a few confirmed counterexamples to Jesus’s claim:
The Egyptian army pursued their escaping Israelite slaves with drawn sword, but they didn’t die be the sword. They died when God drowned them.
David drew Goliath’s sword and cut off his head with it. And as far as I can tell, David died peacefully in bed.