The cohomology ring functor
$$X \mapsto H^{\bullet}(X) : \text{Top}^{op} \to \text{CRing}^{\bullet}$$
does not preserve either finite limits or colimits. (Note that since it's contravariant, the meaning of "preserves" is "sends finite limits resp. colimits to finite colimits resp. limits.")
For a counterexample involving pushouts take
$$S^n \cong D^n \sqcup_{S^{n-1}} D^n$$
and for a counterexample involving pullbacks take
$$\mathbb{Z} \cong \mathbb{R} \times_{S^1} \mathbb{R}.$$
The issue is that limits and colimits in $\text{Top}$ don't respect homotopy equivalences (see what happens when we replace the contractible spaces $D^n$ and $\mathbb{R}$ in the above counterexamples by points), so there's no hope for them to have nice behavior with respect to a homotopy invariant functor. To fix this we replace them with homotopy limits and colimits, which you can think of as the "nonabelian derived functors" of limits and colimits, and which do respect homotopy equivalences. (The above pushout resp. pullback is in fact a homotopy pushout resp. pullback, but this is no longer true if we replace $D^n$ resp. $\mathbb{R}$ by a point.)
If we think of cohomology as producing not a graded ring but a ring spectrum, then it becomes a representable functor $[X, H \mathbb{Z}]$ in a homotopy sense, and then we expect it to send homotopy colimits to homotopy limits. After passing to the individual cohomology groups this becomes a kind of Grothendieck spectral sequence.
Dually, if we lift homotopy to take values in spectra rather than graded abelian groups, it ends up being a kind of tensor product $H \mathbb{Z} \otimes X$ which is in particular a left adjoint, so it sends homotopy colimits to homotopy colimits; after passing to the individual homology groups we get another spectral sequence.
As far as I know, neither homology nor cohomology have good behavior with respect to homotopy limits in general, although some things can be said in some cases, e.g. the Serre spectral sequence.
Edit: The notation I'm using is apparently causing confusion. To be precise, by $[X, H \mathbb{Z}]$ I mean the mapping spectrum of maps from $\Sigma^{\infty} X$ to $H \mathbb{Z}$, and by $H \mathbb{Z} \otimes X$ I mean the smash product of $\Sigma^{\infty} X$ and $H \mathbb{Z}$. The reason I write $X$ instead of $\Sigma^{\infty} X$ is that I am thinking of spectra as being tensored and cotensored over spaces; see the nLab for more on this.
The goal of this notation is to be as directly analogous to the $0$-truncated case as possible; in this case $X$ is a set, cohomology means the set of functions $X \to \mathbb{Z}$, and homology means the free $\mathbb{Z}$-module $\mathbb{Z}[X]$. These can be described in terms of a tensoring and cotensoring of abelian groups over sets.