In special relativity we define momentum as
$$
\frac{m v } {\sqrt{1 - v^2 / c^2}} \tag{1} \label{1}
$$
and energy as
$$
E = \frac{m c^2 } {\sqrt {1 - v^2 / c^2}} \tag{2} \label{2}
$$
So with these, we can derive relation for momentum and energy:
$$
\begin{align}
E^2 - p^2 c^2 =& \frac{ m^2 c^4 - m^2 v^2 c^2} {1 - v^2 / c^2} \\
= & \frac{ m^2 c^4 ( 1 - v^2 / c^2)} { 1 - v^2 c^2} \\
= & (m c^2)^2 \tag{3}\label{3}
\end{align}
$$
Physicist say for massless particle (photon) $E$ is indeterminate $0/0$ and the same also for momentum (you can have zero mass, provided you have same velocity with $c$ ). So equation $\ref{3}$ become
$$
E = p c \tag{4} \label{4}
$$
But how we can say equation $\ref{4}$ is true whereas it is derived from (depend on) result in equation $\ref{3}$. If $m = 0$ then $E^2 = 0$ and $p^2 - c^2 = 0$$p^2 c^2 = 0$ too and it is become trivial identity $ 0 = 0$.
And if we still forcing to use equation $\ref{4} $ we must remember that for photon, energy and momentum are indeterminate and can take any values, $E = 0/0$ and $p = 0/0$ so equation $\ref{4}$ become a strange form $$ 0/0 = 0/0 $$ LHS can be filled with any values, and also RHS, and it is inconsistencies in mathematical formulation. I can say that $5= 3$, $100 = 200$, $45 = 23$, etc.