Given a commutative square of ringed topoi $$\begin{array}{ccc}X'\!\! & \overset{f'}\to & Y'\!\! \\ \!\!\!\!\!{\small g'}\downarrow & & \downarrow{\small g}\!\!\!\! \\ X & \underset f\to & Y\end{array}\label{Dia square}\tag{1}$$ and an object $K \in D(X)$, there is a canonical base change morphism $$Lg^*Rf_* K \to R(f')_* L(g')^* K;\label{Dia base change}\tag{2}$$ see for example [Stacks, Tag 07A7].
Coherent story. Assume (\ref{Dia square}) is a pullback square of schemes (with their categories of $\mathcal O_X$-modules), where $f$ is qcqs and $K \in D_{\mathbf{Qcoh}}(X)$. If $g$ is flat, then (\ref{Dia base change}) is an isomorphism [Stacks, Tag 02KH]. This holds more generally if $X$ and $Y'$ are tor independent over $Y$ [Stacks, Tag 08IB]. There are also versions demanding only that $K = \mathscr F \in \mathbf{Qcoh}(X)$ is flat over $Y$ and of finite presentation on $X$, at least if $f$ is proper and of finite presentation [Stacks, Tag 0B91].
It seems that the failure of (\ref{Dia base change}) to be an isomorphism is mostly explained by derived phenomena. When $X$ and $Y$ are not tor independent, it seems conceivable to me that the failure of (\ref{Dia base change}) to be an isomorphism can be salvaged by taking $X'$ to be the derived base change $X \times_Y^{\mathbf L} Y'$ instead of the usual base change (are there any results of this type?).
Étale setting. Now let (\ref{Dia square}) be a pullback square of schemes (or even $\mathbf C$-varieties if you like), but now equipped with the étale topoi of $\mathbf Z/n$-sheaves. If you like, you may assume $K \in D_{ctf}(X_{\operatorname{\acute et}}, \mathbf Z/n)$ (constructible with locally finite tor dimension, see e.g. [Stacks, Tags 03TQ and 08CG]).
Because the sheaf of rings $\mathbf Z/n$ doesn't change, all pullbacks $g^*$ are already exact, so $Lg^* = g^*$. In particular, we already see that flatness and tor independence are not the issue. However, the base change map (\ref{Dia base change}) is not always an isomorphism:
Example. Let $X = \mathbf A^2 \setminus \{0\}$ and $Y = \mathbf A^1$, where $f$ is the first coordinate projection. Let $Y' \subseteq Y$ be the origin, so that $X' = \mathbf A^1 \setminus \{0\}$.
Let $K = \mathbf Z/n[0]$. Then $Rf_*K$ is a complex whose $H^0$ is $\mathbf Z/n$ and whose $H^3$ is $g_*(\mathbf Z/n)$ (the constant sheaf at the origin). On the other hand, $(g')^* = \mathbf Z/n[0]$, and $R(f')_*(g')^*K$ is a complex whose $H^0$ is $\mathbf Z/n$ and whose $H^1$ is $\mathbf Z/n$. So it differs from $g^*Rf_*K$.
Question. Can the failure of cohomology to commute with base change be explained by certain derived phenomena?
For example, is the situation better if we replace $X'$ with some sort of homotopy fibre (when $Y' \subseteq Y$ is a point) or more generally a homotopy fibre product?
It seems that there cannot be a Grothendieck complex that computes $Rf_*K$ after arbitrary base change, because $g^*$ is always exact. So the situation is really fundamentally different from the coherent case, where the non-flatness of $g^*$ accounts for the failure of cohomology to commute with nonderived base change (at least in the situations described above where derived base change holds).