Edit #2: My apologies! This argument doesn't actually work at all and your counterexample works over $\mathbb{R}$ as well; if we take $d(x)$ to be the number of nonzero $p$-adic digits then $f(x) = e^{-d(x)}$ satisfies the desired condition but is not continuous.
The issue is exactly lack of uniformity. For example if we consider $x = 1 - 2^n = \dots 111000 \dots 1 \in \mathbb{Z}_2$ then $f(x \bmod 2^k)$ does converge to $f(x) = 0$ but that converge doesn't begin until $k = n + 1$. So the $K(\varepsilon)$ I was looking for below don't exist and the compactness argument doesn't produce them (the bound only applies to the finitely many $x$ in the open subcover, not to arbitrary $x$).
This is equivalent to saying that $f$ is continuous with respect to the $p$-adic topology on $\mathbb{Z}_p$, which is the topology induced by the $p$-adic metric.
Edit: I'm not actually sure what the cleanest way to prove this is but here's one approach. The convergence $f(x \bmod p^k) \to f(x)$ means that for every $x \in \mathbb{Z}_p$ and every $\varepsilon > 0$ we can find a positive integer $K_x(\varepsilon)$ such that if $k \ge K_x(\varepsilon)$ then $|f(x) - f(x \bmod p^k)| < \varepsilon$.
Now we can consider the open cover of $\mathbb{Z}_p$ by balls of radius $p^{-K_x(\varepsilon)}$ centered at $x$; by compactness this has a finite subcover, from which it follows that we can find a positive integer $K(\varepsilon)$ (namely the maximum of $K_x(\varepsilon)$ over the finitely many points $x$ in this finite subcover) such that if $k \ge K(\varepsilon)$ then $|f(x) - f(x \bmod p^k)| < \varepsilon$, and we have removed the dependence on $x$.
It follows that for any $\varepsilon > 0$, if $k \ge K \left( \frac{\varepsilon}{2} \right)$ and $|x - y| \le p^{-k}$ then $x \equiv y \bmod p^k$ so $f(x \bmod p^k) = f(y \bmod p^k)$, and we also have $|f(x) - f(x \bmod p^k)| < \frac{\varepsilon}{2}$ and the same for $y$. This gives $|f(x) - f(y)| < \varepsilon$. So $f$ is uniformly continuous, hence continuous.
(I don't know if this detour into uniform continuity is necessary.)