Starting with a pyramid on top of a cube, selected all, and click merge by distance with an appropriately small distance with the intention of merging the points at the base of the pyramid and top of the cube:

As you can see, 13 verts selected and zero merged.
Now if I increase the merge distance to the point where it may merge multiple points on the same mesh, I get this:

So merge by distance IS working, it just doesn't want to be the tool that combines meshes. Why?