For $a^2-b^2=p$, with form $ax+by=c$ with $x,y$ being integer variables & $(a,b)\mid c, x=a, y=b$.
So, the $\gcd$ of $(a,b) =p$, with the Bezout's coefficients being $x=a,y=b$.
This value $p$ is in geometrical terms the intercept of the straight line $ax + by = p$ with $x=a, y=b$.
Bezout's doesn't say that all linear combinations of two integers equal the gcd, only that there exists a linear combination that equals the gcd. Just because there is a linear combination of $a$ and $b$ which equals $p$ doesn't mean that $p$ is the gcd of $a$ and $b$.
Take $5, 3$ for instance. $5^2-3^2 = 16$, but $16\neq \gcd(5, 3)$.
As for the question itself, try this approach: Since $p$ is prime, we have that $a^2 + b^2 = (a+b)(a-b)$ is prime. What does that tell us about the two numbers $a+b$ and $a-b$?