When you say you're stuck in a loop, do you mean it's bugged? Whenever you die, the sanity effects reset after you respawn, so it should still be possible to exit the sewer even after it floods. There is a sign showing where the exit is in the pipe on the right.