Hi @Modesty ,
these float switches aren't expensive
https://en.wikipedia.org/wiki/Float_switch
There are float switches that sense HIGH level, LOW level or both. They are built for "outdoor" use.
I use one in my drainage system that switches at a higher level than the pump. The switch is attached to a Raspberry Pi Zero in the basement and sends me an email every day so that I know it's still working and in case the level is too high an email very hour ...
Or - like suggested by @LarryD - a Float (liquid level) like this
Float (liquid level) - Wikipedia
Good luck!
ec2021