There is helpful information about this on, of all places, the railway website.
https://www.italiarail.com/flood-warnings-venice
Basically the issue is that as they say
It happens when an unusually high tide pushes water from the Adriatic Sea into the Lagoon helped by southern winds and low atmospheric pressure. The flooding isn’t dangerous and it’s not considered a big deal, as the water usually subsides within a few hours. In the past century it has become more frequent, and now it can happen any time of year.
So you might want to avoid times of the full or new moon when spring tides occur but otherwise it seems you just grin and bear it.