Why does "merge by distance" not work here?
You have not selected both vertices to be merged. One is 'In Front' of the other, so hiding it from selection.
You have 2 options:

AltZ, toggle into X-ray mode in the viewport, so the back vertex is no longer hidden when making the selection

or

Check 'Unselected' in the operator's F9 Adjust Last Operation panel, which will merge selected vertices to all others within the given distance, selected or not.