In the affine case, let $X=\text{Spec }A$, $Y= \text{Spec }B$, and $Z= \text{Spec }R$. If you have morphisms $f:Z\rightarrow X$ coming from $\phi:A\rightarrow R$ and $g:Z\rightarrow Y$ coming from $\psi: B\rightarrow R$ (because $\text{Aff}$ is anti-equivalent to $\text{CRing}$), then the pushout $X \coprod_{Z} Y$, gluing $X$ and $Y$ along $Z$ is given by $\text{Spec }D$, where
$D=A\times_{R} B:=\{(a,b) \in A\times B \mid \phi (a)= \psi (b)\}$.