I'm tinkering with a servo and an ultrasonic sensor on my uno but while coding stumbled upon this error which I cant seem to figure out. I only get other errors when I try to fix it.
You have a multitude of issues with the code. You have functions defined within your loop() function, misplaced semicolons, and referencing variables outside of their scope. You should review some fundamental C/C++ concepts.
I would try to fix your code but then I wouldn't be sure if it would operate as intended.