You might want to consider the loop logic. The simple implementation just keeps checking the distance and adjusting the servo. This results in the servo getting repeat commands continuously like:
go 175
go 175
go 175...
Instead, you can remember the state of the servo, and only change it when the input changes.