This is exercise 2.2.25 in Hatcher's Algebraic Topology:
Show that for each $n \in \mathbb{Z}$ there is a unique function $\varphi$ assigning an integer to each finite CW complex, such that
(a) $\varphi(X) = \varphi(Y)$ if $X$ and $Y$ are homeomorphic, (b) $\varphi(X) = \varphi(A) + \varphi(X/A)$ if $A$ is a subcomplex of $X$, and (c) $\varphi(S^0) = n$.
For such a function $\varphi$, show that $\varphi(X) = \varphi(Y)$ is $X \simeq Y$.
Playing around with it, I find that $\varphi(D^k)=0$ for any disk $D^k$ (collapse half of a sphere, leaving something homeomorphic to the sphere), and $\varphi(A \sqcup B) = \varphi(A) + \varphi(B)$. Now suppose I have $D^1 \sqcup D^1$, each disk composed of two zero cells and a one cell. I pick one zero cell from each disk, and quotient by this subcomplex, and the subcomplex is homeomorphic to $S^0$. But since the quotient is homeomorphic to a disk again, it seems the axioms cannot hold, since this gives $0 = n + 0$. Where am I going wrong?
The problem is that $\varphi(A \sqcup B)$ is not equal to $\varphi(A) + \varphi(B)$. You didn't say how you proved that, so I can only guess, but $(A \sqcup B) / B \cong A \sqcup *$, not $A$, so you get $\varphi(A \sqcup B) = \varphi(A \sqcup *) + \varphi(B)$, and $\varphi(A \sqcup *) \neq \varphi(A)$. If $A$ is nonempty, take some point $x \in A$ and then collapse $\{x,*\} \cong S^0$ to get $\varphi(A \sqcup *) = \varphi(A) + n$, hence if $A$ is nonempty (or symmetrically if $B$ is nonempty): $$\varphi(A \sqcup B) = \varphi(A) + \varphi(B) + n.$$
If it can help to guess how it works, notice that $\varphi(X) := n \cdot (\chi(X) - 1)$ satisfies all the conditions. It's true that $\chi(A \sqcup B) = \chi(A) + \chi(B)$, but this doesn't hold for $\varphi$ anymore.