Isaske
first of all, I think it works really well. that worm is pretty creepy! :)
I had major trouble getting it to break apart, and it corrects itself so fast that I don't think it is much of a problem.
There are only two things you can do to minimize the issue:
1) each time you update the position of a body segment, check to see if it is more than the actual segment width from the previous segment (or head) - which is 33 pixels (but then shrinks as the segments get smaller). And if it is too far away, then calculate a position that wont leave a gap.
2) or, make the segments twice as wide so there is more overlap. that way, if there is a glitch in frame rate, the worm can stretch out without showing a gap.
I made a quick test to see what that would look like (you will obviously have to make your artwork look nicer). I also slightly changed the way the array works so you don't have to do so much overhead combining and then breaking apart the values you want to store (I made the array 2 dimensional instead of 1). I also pre-calculate the max array length. Anything you can do to reduce the work-load each tick makes things run smoother (and reduces the chance that you might drop a frame or two and get a gap).
you can see my version here: https://www.rieperts.com/games/forum/worms.capx