Connecting a distance sensor with servo motor

Pick a servo and pick a sensor. You will find examples for both in the IDE and libraries.