We can approximate the distribution of the nearest neighbor probability under the null hypothesis that the two datasets are perfectly aligned (via Binomial-Normal approximation).
Then we can apply the nonparametric Kolmogorov–Smirnov test to test the null hypothesis.