First let us find out what rangefinder that you are using. Is it a HC SR 04 type? I am going to assume so.
I am not sure that you know how a rangefinder works. The range is not reported through A0 as an analog value. The echo signal will be HIGH or LOW (255 or 0). If it is HIGH the map will make distance_cm 255 which is beyond what the servo can do. Using analogRead on the echo pin is pointless. The distance is calculated from the duration returned by the pulseIn() function.