When a Swamp Wisp spots a player, it will rapidly fly at them, inflicting half a heart of damage every half a second it remains in contact. They can be killed, despite having a simple 2D model.
If the name is to be taken literally, Swamp Wisps may not be insects at all, and may instead be based on Will-o'-the-Wisps. If this is true, there is irony; Swamp Wisps are not immune to fire or lava. This also provides an answer on how they attack the player, however; if Swamp Wisps are made of fire, they would burn the player on contact.
Those adept enough at melee combat can kill one, or those with a deadshot can eliminate one from afar with a ranged weapon. Armour with the Thorns enchantment (or similar from a mod) will kill the Swamp Wisp swiftly.