Universal coefficient theorem with ring coefficients
Solution 1:
$\DeclareMathOperator{\Ext}{Ext}$The exact sequence mentioned in Wikipedia is only a corollary of a more general theorem; the corollary is only true for PIDs. The spectral sequence has the form: $$E_2^{p,q} = \Ext{}^q_S(H_p(X), R) \Rightarrow H^*(X; R)$$
I won't delve into the details if you don't know anything about spectral sequences, but when $S$ is a PID (so for example $S = \mathbb{Z}$) the higher $\Ext$ functors disappear (because every module has a projective resolution of length at most one). So the spectral sequence degenerates, and you're left with the exact sequence that you mention. But in full generality, you cannot get rid of the higher $\Ext$ terms, the differentials that appear in the SS, and the extension problems at the $E_\infty$ page.