Difference between IR sensor for distance measurement and for Line following

I am making a line following robot and I am a bit confused about the IR sensors.I found some Infrared sensors(tcrt5000) for line following but their range i.e 0 - 2.5 mm is too small for me.The next thing I found where some Infrared sensors that measure distance and have a range of 2-10 cm(MH-B).So, my question is whether I can use this MH-B sensor for black line detection.

No since these sensor give a distance and doesn't discriminate between colors (usually!).
tcrt5000 is composed by an infrared LED and a infrared photodiode, you can built yourself a sensor like this.