This isn't an issue with this library directly but it took me a bit to get everything working so I thought I might as well leave a comment here which will hopefully help out some other people.
When using this library or really any lib with the ESP32 that uses analogRead the WiFi module causes some issues with many of the pins causing them to read only 0 values. This will cause this library to divide by zero which I think is where one of the other issues in this repo come from.
The solution for me was to simply use pin 36 on the ESP32 and all was working fine after that.
It might be helpful to update the docs with some debugging notes mentioning this issue, if so, I can make a PR including that info.
The input and output voltage of GP2Y0A21YK0F is 5v, but the voltage level of the ESP32 pins is 3.3 volts so how is your code able to handle this. Please can you provide the connection diagram.
The analogRead can be 0.
I fix it with +1 because 1 more ist for me not a Problem.
Tomorrow I will fix it better by checking if 0 then it will be 1 else the real value.