$\ce{NH4OH}$ assumes $\ce{N}$ is able to form 5 bonds. It is not.
The $\mathrm{p}K_\mathrm{a} = 5.23$ for phosphoric acid is nonsense; the task is made up. Additionally, the above provided formulat is not applicable on salts of multiprotic acids like $\ce{(NH4)3PO4}$
The respective $\mathrm{p}K_\mathrm{a}$ for each of $\ce{H3PO4}$ hydrogen are $\mathrm{p}K_\mathrm{a1}=2.14$, $\mathrm{p}K_\mathrm{a2}=7.20$ and $\mathrm{p}K_\mathrm{a3}=12.37$.
It is possible to have a combined $\mathrm{p}K_\text{a,tot}$ directly for $\ce{H3PO4 \to PO4^3-}$, but it would be their sum, 21.73.
The task can be simplified to ( informed guess assuming $1 \lt x \lt 2$):
$$\ce{3 NH4+ + PO4^3- -> (3-x) NH4+ + x NH3 + (2-x) HPO4^2- + (x-1)H2PO4-}$$
and
$$\mathrm{pH} \approx \mathrm{p}K_\ce{a,NH4+} + \log {\left(\frac{x}{3-x} \right)} \approx \mathrm{p}K_\ce{a2,H3PO4} + \log {\left(\frac{2-x}{x-1}\right)} $$
$$\mathrm{p}K_\ce{a,NH4+} - \mathrm{p}K_\ce{a2,H3PO4} = \log {\left(\frac{2-x}{x-1}\right)} - \log {\left(\frac{x}{3-x} \right)}=\log{\left(\frac {(2-x)(3-x)}{(x-1)x}\right)}$$
Let substitute $A = \mathrm{p}K_\ce{a,NH4+} - \mathrm{p}K_\ce{a2,H3PO4}= +2.05$
$$10^{A} \cdot x(x-1) = 6-5x+x^2$$
$$(10^{A}-1)x^2 + (5 -10^A)x - 6 = 0$$
$$(10^{2.05}-1)x^2 + (5 -10^{2.05})x - 6 = 0$$
$$111.2 \cdot x^2 - 107.2x - 6 \approx 0$$
$$x \approx 1.01708$$
$$\mathrm{pH} \approx \mathrm{p}K_\ce{a,NH4+} + \log {\left(\frac{1.01708}{3-1.01708} \right)} \approx 9.25 - 0.30 = 8.95$$
$$\mathrm{pH} \approx \mathrm{p}K_\ce{a2,H3PO4} + \log {\left(\frac{2-1.01708}{1.01708 - 1} \right)} \approx 7.20 + 1.76 = 8.96$$