Other than making everyone's lives hell and annoy every animal to have ever existed I wonder what is the practical purpose they serve in any given ecosystem.
They can survive lots of places, so they do, and then cause everything else to suffer. Unlike Bees wasps can sting multiple times... Outside of causing suffering I don't know exactly why they originally evolved, but I'm sure that they're not just an invasive species. They keep insect population under control and there are some plants exclusively pollinated by wasps.
Scientists have already discovered a new way to make nonfertile mosquitos that can eventually cut down on wasps if implemented which sounds scary . Theyr'e like "supersexy wasps" that will mate as much as possible, creating (ideally) a generation of wasps that are infertile, gradually making it so there are less and less wasps. I believe they did this via genetic engineering which is actually really cool, but I am not a scientist so if you want more info I recommend googling this.