Finding value of a when the centroid of a region (p,0) is bounded by $y^2 = 4px$ and x = a The problem is basically the title, however I just got stuck when I did two solutions. Here is one of them:
$$y^2 = 4px\\
f(x) = \sqrt{4px}\\
g(x) = -\sqrt{4px}\\
\bar{x} = p = \frac{M_y}{M}\\
M_y = \int_0^ax(\sqrt{4px} + \sqrt{4px})dx\\
= \int_0^a2x\sqrt{4px}dx\\
=4\sqrt{p}\int^a_0x^{3/2}dx\\
\bf{M_y = \frac{8a^{5/2}\sqrt{p}}{5}}\\$$
\
$$M_x = \frac{1}{2}\int_0^af(x)^2-g(x)^2dx\\
=\frac{1}{2}\int_0^a4px-4px dx\\
=\frac{1}{2}\int_0^adx\\
\bf M_x = \frac{a}{2}$$
$$M = \int_0^af(x)-g(x)dx\\
 = \int_0^a\sqrt{4px}+\sqrt{4px} dx\\
\bf M = 4\sqrt{pa}$$
\
$$\bar{y} = 0 = \frac{M_x}{M} =\frac{\frac{a}{2}}{4\sqrt{pa}}\\
= \bf\frac{1}{8\sqrt{pa}}$$
\
$$\bar{x} = p = \frac{M_y}{M} = \frac{\frac{8a^{5/2}\sqrt{p}}{5}}{4\sqrt{pa}}\\
= \bf \frac{2a^2}{5}$$
After all of this stuff, I get stuck. Trying different methods to find the value of using these values doesn't get me a concrete answer. Some of them even result in contradictions such as 1 = 0.
What did I do wrong in my solution? Is my solution even right in the beginning? Any answer would really help :D

You have a few mistakes. It is easy to see by symmetry that $M_x = 0$.
$M = \displaystyle \int_0^a (\sqrt{4px}+\sqrt{4px}) \ dx$
$ = 4 \sqrt p\displaystyle \int_0^a \sqrt{x} \ dx = \frac{8 \sqrt p}{3} a^{3/2}$
As you calculated, $M_y = \displaystyle \frac{8 \sqrt p}{5} a^{5/2}$
So, $p = \overline {x} = \displaystyle \frac{3a}{5} \implies a = \frac{5p}{3}$
