Algorithms like KNN which measure the distances between data points can use several different approaches: for example the euclidean distance:
where d(p,q) is the distance between two data points in a euclidean space. The Manhattan distance according to Wiktionary is: the distance between two points in a grid based on a strictly horizontal and/or vertical path (that is, along the grid lines), as opposed to the diagonal or "as the crow flies". The Manhattan distance is part of taxicab geometry.
The Scikit learn KNN class allows different distance metrics to be used via the get_metric class method and the metric string identifier. Metrics available: