When planting dragon fruit at this stage, as you will not be moving the dragonfruit cactus after this final planting, make sure you plant the dragonfruit in an area that will have plenty of sun for the mature dragonfruit cactus! If you need to shade the newly planted dragonfruit cactus, that is fine. Remember - it is far better to have to shade the newly planted dragonfruit than to have to move the mountain which is blocking the sun 3 years from now! The mature, established dragon fruit cactus plant is more sun tolerant than the young sensitive cactus plants, but if you are in a region with intense sun (e.g. areas of Southern California in the US), you may need to either be prepared to cover your cactus plants to give them some shade, or need to plant them where their sun exposure in high summer will be limited.
Space the dragonfruit cactus with the desired size of the mature dragonfruit cactus plant in mind. You can let a single dragonfruit cactus grow to be very large, but most likely you want to keep the size modest. Plan on several meter (several yards) between each dragonfruit cactus plant in a given row and keep rows about the same distance apart from one another. If you plan to prune the mature dragonfruit cactus closer, then you can plant the dragonfruit cactus plants closer and visa versa. A distance of 2-3 meters is a good safe distance from one dragonfruit cactus plant to another. Anything closer than 1 meter is probably too close!