This question already has an answer here:
I have a stream network dataset and am attempting to do a distance analysis between paired points located in two different layers. Ex. I have 500 points in layer A with given coordinates, and then 500 points with different coordinates in layer B. I plan to base the distance-pairing on a shared ID. Having looked at other questions related to this, I have often seen the OD Cost Matrix suggested as a solution, or tools that give linear distance. I don't think the OD Cost Matrix will work for me- I want the stream network distance between the points that share an ID, not the distance between Point A and all other points.