You used unreal right? There is an option to disable rotation I believe when grabbing with a physics component (which it looks like you're using here), but I do remember having trouble myself when doing these things. You could also look into constraining the cubes' movement along one axis (or two axes if it helps).
If you are into puzzle games feel free to link up outside this if you want to collaborate. Hilariously and ironically enough I was already in the process (like, several months in) of creating a time-travel themed 3rd person adventure/rpg type game, but had to come up with an entirely new idea for the purposes of this jam (a 2.5D platformer with some puzzles obviously). I'm on discord, feel free to message me. You've shown great skill in designing puzzles which is great! I'd like to work with people like that ;)