It can be used against the Elite 4 although it's not normally worth wasting the turn for. Much better to learn an attacking move, especially in-game.
As Pikamaster said in the comments Heal Block doesn't stop Potions from healing so it's definitely not worth learning.