When printing pieces that will interlock or interact with each other, it is important to realize that a 5 mm peg will not fit a 5 mm hole. What is needed is a small offset so that the pieces fit into each other. The difference is very small, often measured in units of ten thousands of an inch (1/10000″) or in micrometers (0.1 mm).
These small differences are necessary but printer dependent and can define what the limits are to the size of the interacting pieces are that you print. There is a threshold below which the printer’s inherent limitations to resolution prevent successful printing of the necessary detail.
To calibrate your 3D printer, check out this https://teachingtechyt.github.io/calibration.html
To work on 3D printing joints, check out this link: https://3dprinterly.com/how-to-3d-print-connecting-joints-interlocking-parts/