Planting groundcover is a great solution for hard-to-grow areas of the yard, but it can be hard to contain once it take off. Many of these plants spread by runners and roots, so you have to create a barrier both above and below the soil to adequately control them. The solution is called garden edging.
There are a number of plastic edging products available that you either dig or press into the soil at the borders of the beds. Plastic edging is inexpensive, flexible, and available in a range of styles and sizes.
A more permanent and approach is to use solid brick pavers for for edging. The bricks can be dug in horizontally or vertically to create a barrier to control the uncontrolled spread of groundcover.