Regarding your other posts, something like this comes to mind:
Now… if you want to fix a segment, then you might need to iterate through all the points and match those that are closest within a radius:
Result:
You can set custom events to be run in the editor by ticking the CallInEditor checkbox:
But I warn you… this is permanent, meaning you will not be able to undo this so work with a copy.
Idk if there is another way to do this. Would be cool if more experienced pitched in.