If I'm not mistaken, the pasting lemma for a two-element open cover $X=A\cup B$ of a topological space is equivalent to saying that the following square is a pushout in $\mathsf{Top}$: $$\begin{matrix} A\cup B & \longleftarrow & B \\ \uparrow && \uparrow \\ A & \longleftarrow & A\cap B\end{matrix}$$ where the arrows are the canonical embeddings.
Is my statement true, and if so, how can I categorically formulate the pasting lemma for general open covers $ \left\{ U_i\right\} _{i\in I}$?
Let $\{ U_i : i \in I \}$ be an open cover of $X$. Let $\mathcal{J}$ be the poset of subsets of $I$ of size $1$ or $2$, ordered by inclusion, and consider the diagram $V : \mathcal{J}^\mathrm{op} \to \mathbf{Top}$ sending each $J \subseteq I$ to $\bigcap_{j \in J} U_j$. Then $X \cong \varinjlim_{\mathcal{J}} V$. (Just check the universal property!)
What is essential in the above is that each $U_i$ is open in $X$. On the other hand, you might like to verify for yourself that we can replace the poset of subsets of $I$ of size $1$ or $2$ with the poset of non-empty finite subsets of $I$.