OK. I have kind of done it. Not quite as clamped as I would like but still not bad.
Pick up the pink blocks and use them to play around with the blue platform. There is some physics wonkiness - but part of it is to do with combining physics with drag 'n' drop which is never a good idea.
Basically this is achieved in a single line of code! Every tick, a force is applied proportional to the distance away from the target Y. This creates a spring effect and if you make the force large then the spring is pretty strong. Note that the spring is easily able to cope with gravity.
Better results could be achieved by balancing density, force strength, linear damping.
So the first rule of game physics applies: do everything with forces.