That is unfortunately the netcode for you. Happens to many people, specially if ping goes high at that moment. It forces you to press potion several times before it starts to fill. Sometimes you can just fill potion to the 2/3rd of the cast bar and just start moving and it will fill and get you HP. It's so ridiculous. Sometimes even taking potions on the ground are triggered by latency and you can come to potions 2 seconds before an enemy but it won't trigger for you and will give them instead.