A single force on a free object usually just makes it move. To change the shape of an object, more than one force must act on it, and the forces must act in different directions so that the object is squeezed, pulled or bent out of shape instead of simply being carried along.
To stretch a spring, a force pulls on each end in opposite directions. If only one end were pulled and the other end were free, the whole spring would just move. In practice a clamp or your other hand supplies the second force. To compress a spring, two forces push inwards, one on each end, towards each other.
To bend an object, forces act at different places and in different directions. A plastic ruler resting on two supports bends when you push down on its middle: the downward push and the upwards forces from the two supports make three forces in total. In real life a bungee cord stretches as a jumper falls, a mattress compresses when someone lies on it, and a diving board bends under a diver.