The key issue with the base $10$ representation being unique is that the digits are restricted to being between $0$ and $9$ inclusive (note that without this limitation, the representations may not necessarily be unique). The main reason this is important is that the difference in digits is limited to being between $-9$ and $9$, inclusive. To see why this is important, consider what you've stated, i.e.,
$$n = \sum_{i=0}^{p} x_i 10^{i} = \sum_{i=0}^{q} y_i 10^{i} \tag{1}\label{eq1}$$
where $p,q, \in Z_{\geq 0}$, each $x_i$ & $y_i$ is a digit of $0$ to $9$, $x_p \neq 0$ and $y_q \neq 0$. To make it a bit easier for processing in case $p \neq q$, let $r = \max(p,q)$ and extend $x_i$ to be $0$ for any $i \gt p$ and $y_i$ to be $0$ for any $i \gt q$, so \eqref{eq1} becomes
$$n = \sum_{i=0}^{r} x_i 10^{i} = \sum_{i=0}^{r} y_i 10^{i} \tag{2}\label{eq2}$$
Subtracting the middle & LHS parts of \eqref{eq2} gives
$$0 = \sum_{i = 0}^{r} \left(x_i - y_i\right) 10^i \tag{3}\label{eq3}$$
If $x_i \neq y_i$ for one or more $i$, let $k$ be the smallest one. Thus, for all $i \lt k$, $x_i = y_i$ so $x_i - y_i = 0$, causing those terms to all become $0$. They can therefore be ignored, simplifying \eqref{eq3} to
$$0 = \sum_{i = k}^{r} \left(x_i - y_i\right) 10^i \tag{4}\label{eq4}$$
Next, dividing both sides by $10^k$ gives
$$0 = \sum_{i = k}^{r} \left(x_i - y_i\right) 10^{i - k} \tag{5}\label{eq5}$$
Note that all of the terms on the RHS of \eqref{eq5} have at least one factor of $10$ except for the first one. Since $10$ divides $0$, plus all of the terms on the RHS of \eqref{eq5} after the first term, this means the first term of $\left(x_k - y_k\right)10^0 = x_k - y_k$ must be a multiple of $10$. Since $-9 \le x_k - y_k \le 9$, this means that $x_k - y_k = 0$, i.e., $x_k = y_k$, so they can't be different. This contradicts the assumption that there is at least one digit different, thus showing that all of the digits up to $r$ are the same. This also means the highest non-zero ones must be the same, i.e., $p = q$.
This same basic argument can be used to show that an integer can be uniquely represented in any base $b \ge 2$ as long as the digits used are in the range of $0$ to $b - 1$, inclusive (e.g., binary using $0$ and $1$, or hexadecimal using $0$ to $F$).