Hi there!
Here is a tutorial for a standard ultrasonic sensor, the HC-SR04:
And here is a tutorial for an infrared sensor:
https://playground.arduino.cc/Main/PanasonicIrSensor
Keep in mind these are for specific sensors, which may differ from the ones you have.
Good luck!