Not all herbs are invasive, but there are a couple of ways to keep the troublesome ones under control. Bee balm (Monarda didyma), mint (Mentha spp.), costmary (Tanacetum balsamita) and wormwood (Artemisia vulgaris) spread by aggressive underground runners, but they can be kept under control with a barrier they can’t penetrate.
Select a plastic pot, old bucket or any other container with solid sides that won’t rot underground or freeze and break. Make sure it is at least 6 in. deep and large enough to accommodate the plant, or as large as you want the clump to get. Cut the bottom out of the container or punch several holes in the bottom for drainage. Dig a hole in the garden and set the container in place with the cut end down. Make sure the rim is an inch or so above grade level. Fill the container with garden soil and set the plant in the center. Put soil around the pot and firmly tamp it in place. A layer of mulch will help disguise the exposed rim. Once it’s planted, no special care is needed.
Some herbs, such as lemon balm (Melissa officinalis), purple perilla (Perilla frutescens) and dill (Anethum graveolens) spread by seed. The only way to control these is by deadheading — removing the spent flowers as soon as they fade.