The simple answer would be a potentiometer, as used for position feedback in a servo. You apply a voltage to the outer two contacts and measure the voltage at the moving, middle connection.
The next step would be a rotary encoder. These should give you less friction and more accuracy, if you need it.
A camera would require significant processing power, but ...
TL;DR: it depends entirely on the situation in which you intend to use the sensors.
According to this article, it is entirely dependent on your application.
You’ve mentioned you want to use it for obstacle avoidance, but the environment in which you want to do this is important.
IR sensors are easily affected by external conditions such as ambient light ...