Friend!!! ..... Most of the time.....
Red Marked Mason Wasps Pachodynerus erynnis, also called Red and Black Mason wasps are actually pretty cool when you begin to learn about them. They are solitary wasps and build intricate nests in hollowed out branches and sticks. They are not aggressive towards people and they do not sit on their nests to protect them. Instead, they rely on their construction to protect their eggs. So why are they only "sometimes" a gardening friend?
These predatory wasps are great additions to your ecosystem helping to control unwanted "worms" aka caterpillars such as armyworms, pickleworms, budworms, leafrollers, and more. In fact these wasps depend on caterpillars for their young to survive. To gardeners who have gardens specifically designed to attract desired butterfly species, these wasps will work against you. They don't just prey on the unwanted caterpillars such as armyworms. That would make gardening too easy! To a wasp, food is food and sometimes it is a bummer when you watch a monarch caterpillar become stung and paralyzed by this same wasp. The ultimate observed negative impact in the garden, is the potential for reduction in pollinator larvae and therefore reducing the pollinator population. To what extent is a guess at best. But that is part of the ecosystem that we gardeners have to respect and should be striving for. Eventually achieving balance.
Looking past the delicate topic of caterpillar killing, these wasps are very interesting. The females build nests inside hollowed out sticks and branches. Imagine a single piece of bamboo or other tubular structure. Inside, they will build "cells" or "rooms" using mostly sand and grit to divide them. Eventually a plug on the "front door" is created. This illustration was pulled from the University of Florida's Entomology & Nematology website. In each "cell" they will deposit one egg and one paralyzed caterpillar. When the egg hatches, the larvae begins to consume the caterpillar and then make its way out. Fertilized eggs become females and are typically located in the innermost section of the nest. Unfertilized eggs become males and hatch quicker so they are laid in the "cells" closer to the closing plug. In order to better help the larvae find their way out, the wasps shapes the plugs towards the exit. The picture below is from the University of Florida's Website (link at the end of this post).
If you want to attract these predators to your garden, a bee house can be bought online or built using small diameter bamboo stick. These will not only attract the Red Marked Mason Wasps, but also other bees and wasps that build nests in a similar fashion.
For more info in great detail check out the University of Florida's page on these wasps:
https://entnemdept.ufl.edu/creatures/MISC/WASPS/Pachodynerus_erynnis.html