This is a solution if you want the valve open when switch is low, but force the valve closed for at least 5 sec when switch goes high (it will stay closed until switch is low AND timer has expired).
Here is one of many solutions if you want the valve open when switch is low, but the valve should alternate between open & closed when the switch is high (which seemed to be what you were asking for in your initial post—NOT a good idea if valve is letting fluid in until sensor says it is full; you will keep opening the valve while tank is already full).
The flip-flop is to remember if the valve is on or off. The count is to toggle the flip-flop every 5 seconds. The clock is only enabled if the switch is high OR the flip-flop is currently off (the not & defer nodes on the left side). If the switch goes high, it immediately resets the flip-flop (closes the valve) and resets the clock (so we get a full 5 seconds off). With each tick of the clock (every 5 sec) the valve will change (on to off or off to on) as long as the switch is high.
If the switch goes low while the valve is on, then the clock is disabled and valve will stay on. If the switch goes low while the valve is off, nothing changes until the clock ticks again & turns the valve back on. Now the valve is on and the switch is low, so the clock is disabled (so the valve stays on until the switch goes high).