user52609: 
Are the IR sensors used in Line following Robot and Obstacle avoidance Robot with Arduino UNO different ? If yes , where do we buy these parts online ? I used the following sensor in my Line Follower and am not getting result as it’s detecting obstacle instead of black line . 

user19409: The sensor you have used is fine. There is a potentiometer on the sensor PCB that is used for the range. For the line following robot you would want the range small, between 1-4cm. However, for the obstacle avoidance robot you would want to set this for a much larger range, say 10-45cm.
To make an effective line following robot you need at least 2-3 sensors.
Here is one using 2 LEDs either side of the line:

And here is a 3 sensor robot:

Notice that one LED stays on the line.
And finally a 5 sensor robot:

The following websites have good step by step guides where they explain the various techniques:

https://www.learnrobotics.org/blog/how-to-build-a-mobile-robot-using-arduino-part-4/
https://circuitdigest.com/microcontroller-projects/line-follower-robot-using-arduino 
http://www.robotc.net/wikiarchive/Tutorials/Arduino_Projects/Mobile_Robotics/VEX/Using_the_line_tracker_to_follow_a_line

When I made my line following robot I used 2 of the following sensor:

These sensors were great as they pointed in towards each other, making a focal point. You can do this to your sensor by bending the LEDs slightly towards each other.

52609: <p><img src="https://i.stack.imgur.com/Pgokk.png" alt="enter image description here"></p>

<p>Are the IR sensors used in Line following Robot and Obstacle avoidance Robot with Arduino UNO different ? If yes , where do we buy these parts online ? I used the following sensor in my Line Follower and am not getting result as it’s detecting obstacle instead of black line . </p>
 19409: <p>The sensor you have used is fine. There is a <a href="https://en.wikipedia.org/wiki/Potentiometer" rel="nofollow noreferrer">potentiometer</a> on the sensor PCB that is used for the range. For the line following robot you would want the range small, between 1-4cm. However, for the obstacle avoidance robot you would want to set this for a much larger range, say 10-45cm.</p>

<p>To make an effective line following robot you need at least 2-3 sensors.</p>

<p>Here is one using 2 LEDs either side of the line:<br>
<a href="https://i.stack.imgur.com/qk9aU.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qk9aU.jpg" alt="2 sensor robot"></a></p>

<p>And here is a 3 sensor robot:<br>
<a href="https://i.stack.imgur.com/2Uybs.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2Uybs.jpg" alt="3 sensor robot"></a><br>
Notice that one LED stays on the line.</p>

<p>And finally a 5 sensor robot:<br>
<a href="https://i.stack.imgur.com/LJBCi.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LJBCi.jpg" alt="5 sensor robot"></a></p>

<p>The following websites have good step by step guides where they explain the various techniques:</p>

<ul>
<li><a href="https://www.learnrobotics.org/blog/how-to-build-a-mobile-robot-using-arduino-part-4/" rel="nofollow noreferrer">https://www.learnrobotics.org/blog/how-to-build-a-mobile-robot-using-arduino-part-4/</a></li>
<li><a href="https://circuitdigest.com/microcontroller-projects/line-follower-robot-using-arduino" rel="nofollow noreferrer">https://circuitdigest.com/microcontroller-projects/line-follower-robot-using-arduino</a> </li>
<li><a href="http://www.robotc.net/wikiarchive/Tutorials/Arduino_Projects/Mobile_Robotics/VEX/Using_the_line_tracker_to_follow_a_line" rel="nofollow noreferrer">http://www.robotc.net/wikiarchive/Tutorials/Arduino_Projects/Mobile_Robotics/VEX/Using_the_line_tracker_to_follow_a_line</a></li>
</ul>

<p>When I made my line following robot I used 2 of the following sensor:<br>
<a href="https://i.stack.imgur.com/csvNJ.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/csvNJ.jpg" alt="IR sensor"></a></p>

<p>These sensors were great as they pointed in towards each other, making a focal point. You can do this to your sensor by bending the LEDs slightly towards each other.</p>
