Has anyone tried to put an HC-SR04 in a tube.

...the ranging accuracy can reach to 3mm.

You may want to play with the sensor in the bathtub. Even under ideal conditions you may not get 5mm accuracy trying to measure water level.