Owning a 3D printer seems to progress through stages. You start printing simple shapes. Then you get serious about calibration and quality. Eventually, you move to trying to design and build practical things. To get practical, you often need to join parts together and that requires glue, fasteners, threaded inserts, and plastic welding. However, you can also make parts that fit together using friction and the springiness of plastic. For example, [Lucas Carolo] recently had a look at 3D printing snap-fit joints. These are commonly seen on the end of straps so that you can connect two ends together.
Of course, you can use them anywhere you need a secure connection. However, you might want to consider that since the jaws compress, there will be repeated stress on the part, so it might not be a good choice for items that you will frequently snap together. Also, brittle plastic such as PLA might not be the best choice of materials. There are several different kinds of joints. The cantilever version has a hook that bends into place and, as mentioned earlier, is common on luggage or backpack straps. The post offers tips on how to design a durable hook. In particular, the orientation of the hook during printing is critical because of the stress involved.
Another type of snap-fit joint is the kind you find on many snap electronic enclosures or things like pen caps. In these joints, a large bump (a boss) fits into a similar groove on the other part. The post has a little less information on these but does mention that you should form the bosses with a chamfer. If you want more details, the post links to a great guide and an enclosure tutorial that you should check out.