Use the Cylindrical Joint node for 3D components to create a joint between two components such that they are free to translate relative to each other along the joint axis and also free to rotate relative to each other about the same axis.
See Prismatic Joint for all settings — Attachment Selection, Center of Joint, Axis of Joint, Joint Elasticity, Joint Forces and Moments, Advanced, and Sketch.