On the square distance function from a manifold with boundary