continuous servo

I need to control a servo by an Arduino-UNO to rotate continuously and stop rotating after an ultrasonic sensor detect a change in distance, I have the ultrasonic sensor, Arduino and the servo, but I have no idea where to start in programming them

Google "arduino using a servo" and then "arduino using an ultrasonic sensor"
Those two searches alone return a score of tutorial and topics.

A couple stickies at the top of the programming questions page on this site, "Using millis() for timing. A beginners guide" and "Useful links - check here for reference posts / tutorials" give some general tips which will be useful when trying to achieve your stated goal.

Another good one to study is Several Things at a Time. That one will give you the techniques required to control something while checking on the status of something else apparently simultaneously.