Any joint needs some space between parts in order for them to fit together. This space is called clearance. 0.3 mm is good for most 3D printers, though this can fluctuate between 0.2 and 0.6 mm.
For example, if you’re designing a ball-and-socket joint with a ball radius of 5.00 cm, the inner radius of the socket part should be at least 5.03 cm, even if they need to fit very tightly together.
This is definitely subject to trial and error: In some situations, you want very little clearance between parts (e.g. interlocking joints), but in others, you want a lot of clearance (e.g. wheels on a car).
To test the clearance of your design, try printing out only the parts around the joint. That way, you can adjust the fit of your joint without wasting filament printing out a whole part.