You have
$$(y_p-y_a)^2 = (-(y_a-y_p))^2 = ((-1)\cdot (y_a-y_p))^2=(-1)^2(y_a-y_p)^2=(y_a-y_p)^2$$
so no, the order doesn't matter.
* * *
You could also just as easily write $|y_p-y_a|^2$ if that makes it any clearer.
You have
$$(y_p-y_a)^2 = (-(y_a-y_p))^2 = ((-1)\cdot (y_a-y_p))^2=(-1)^2(y_a-y_p)^2=(y_a-y_p)^2$$
so no, the order doesn't matter.
* * *
You could also just as easily write $|y_p-y_a|^2$ if that makes it any clearer.