It really depends on the pairing, but when two types of plants compliment each other by providing shade, insect or animal repellant, or even improved soil conditions, then planting them close is usually going to be fine. The most important thing to consider is what nutrients they need, as well as how much sunlight, and what type of soils they like. The goal is to make sure that they aren’t competing for exactly the same resources if they are planted close to each other. You don’t have to plant them right next to each other, though. Plants can be within 2 to 3 rows of each other and still be considered ‘companions’, just keep in mind that those perks you are wanting are going to need a little close proximity if you really want to make the most of a good pairing.