As stated in this question, colimits of $\mathsf{Set}$-valued diagrams $F:D\to \mathsf{Set}$ can be calculated as $\varinjlim F=\coprod_{x\in D}T(x)/\sim$, where $\sim$ is the minimal equivalence relation such that $(x,y)\sim(x',(Ff)(y))$ for all morphisms $f:x\to x'$ (this can be seen as "forcing the diagram to commute" in $\mathsf{Set}$).
Such constructions of colimits are used in many other cases - for example, the stalk of a presheaf of rings $\mathcal{F}$ on $X$ at a point $x\in X$ is the colimit $$\mathcal{F}_x=\underset{U\ni x}{\varinjlim\,} \mathcal{F}(U).$$ It can be more practically thought of as the ring of germs, which are indeed equivalence classes $[(U, s)]$, for $x\in U$ and $s\in \mathcal F (U)$, under the equivalence relation $(U, s)\sim (V,t)$ iff there exists $W\subseteq U \cap V$ s.t. $s\big|_W=t\big|_W$.
In what categories can one generaly calculate colimits as a disjoint union of the diagram modulu this kind of equivalence relation?