As I mentioned earlier, Ohm's law gives us the formula P = IV, where V is the voltage ( also known as the electrical potential difference ) and I is the current. It is confusing that P = I²R and P = IV are one in the same - so I want to go a bit deeper on that.
We have three formulas, P = IV, P = I²R, and P = V² / R. Each are considered the same. The two formulas P = I²R, and P = V² / R are derived from the statement that P = IV, under the condition V = IR. Substitute the value of V from this second condition V = IR into P = IV. You would get the following -
P = I( IR ),
P = I²R
That is how one can derive the formula P = I²R, and how P = IV and P = I²R are thought to be one in the same. If you would like, take a look at how to get the formula " P = V² / R, "
V = IR, P = IV
I = V / R, P = IV
P = ( V / R )V,
P = V² / R
Hope that helps!