How can I use both ultrasonic and IR sensor and ultrasonic sensor at ones with Arduino
Arduinos don't do multithreading. There are a number of attempts at implementing such things, but they're a waste of time and resources.
Instead you need to get into the habit of two things:

Write non-blocking code
Make use of the internal hardware peripherals when possible

The motors, using the hardware PWM, are very much &quot;fire and forget&quot; - set them going and you can forget about them until you want to change their speed or direction.
Ultrasonic sensors can be made both more accurate and more &quot;in the background&quot; by using the Input Capture peripheral of the Arduino.
IR sensors (I assume you mean proximity sensors) are usually either just like a button or a potentiometer - you just read them when you want to know what it's doing.
It's your task to learn how to fit all that together into a single program that reacts to the inputs in the way you want and control the motors in the right way.