H2O distribution in the disc of HD 100546 and HD 163296: The role of dust dynamics and planet-disc interaction