A sequential algorithm for computing the distance map using distances based on neighbourhood sequences (of any length) in the 2D square grid; and 3D cubic, face-centered cubic, and body-centered cubic grids is presented. Conditions for the algorithm to produce correct results are derived using a path-based approach. Previous sequential algorithms for this task have been based on algorithms that compute the digital Euclidean distance transform. It is shown that the latter approach is not well-suited for distances based on neighbourhood sequences.