Merge two separated Meshes

If you join your surfaces into a polysurface before meshing, the vertices will match along the edges.
(see this example)

If there’s some other reason you can’t use that approach, here’s a script for fixing mismatched vertices along edges (though better to avoid creating them in the first place)

For larger gaps where you also need smoothing of the connecting part there’s also this

5 Likes