Wormholes work because gravity curves the space, and it allows two distant points in space to be closer or connected by a wormhole.
There is one force called gravity, that is the force that pull us towards the earth when we jump, and is a force that every object with mass has.
Gravity particularly attracts objects at a rate that depends on the mass of the objects.
Now, if you view the space as a plane, gravity (or actually really massive objects, like planets, starts, etc) have the power of curving that plane.
(thing of a sheet of paper that is curved)
Is really hard to explain this as we need to use relativity and really complex metrics (like the Friedmann–Lemaître–Robertson–Walker metric) to describe the curvature of space.
Once that plane is curved enough, there is a chance that both parts of the plane will "touch each other".
And then we have a "wormhole" that allows a "jump in space".
Learn more about relativity:
https://brainly.com/question/364776
#SPJ1