The two parts (18940 and 18942) form a very useful rack-with-its-housing part, allowing fairly secure back-and-forth movement, which can be driven by a medium motor for instance.
A peg needs to be put inside, to prevent the grey rack part to leave its housing, and then appropriate gears need to be affixed to the housing. One way to do that is to use a double-bevel 12-tooth gear (part 32270) fixed with a 5×3 L beam onto the top two-hole part, and then to continue with an axle, towards other gears:
and eventually towards the motor, affixing the rack to our chassis in the front part:
This is the main idea, but following our interlocking principle, the way we decided to build all this was with a few more parts, all held together by very large 7×11 frame beams (part 39794, also called “liftarm”):
we used one centrally to hold both rack-and-pinions with their two L beams each (total of four), and observe how we “padded” the space with yellow bushings for each gear, to make sure nothing can slide left or right:
Of course, the two black teethed wheels are on their own axles, driven by motors which are “outside”, to the left and right of this image. So, the medium motors and their own gears are held with two more 7×11 frames:
The medium motor themselves are attached “backpack style”, with a 5×7 frame, interlocked with the other frames:
Finally, to properly support all this, the “back” of the vertical part is plated with more frames and 3×11 panels (part 15458), onto which the brick is attached, as well as the gyro (“deep inside”) and a touch sensor for self-alignment of the arms attached to these rack-and-pinions.