Enumerate the set $D = \{d_1, d_2, d_3, \ldots\}$, and define
$$
f(x) =
\left\{
\begin{array}{cl}
1/i & \text{if } x = d_i \in D \\
0 & \text{otherwise}
\end{array}
\right.
$$
Clearly, $f$ is discontinuous at points in $D$. Now consider $x \not \in D$, and fix $\epsilon > 0$.
There are only finitely many points $d_i$ such that $\frac{1}{i} \ge \epsilon$; therefore, we can find $\delta > 0$ such that none of the finitely many points lie in $(x - \delta, x + \delta)$. This implies $|f(y) - f(x)| < \epsilon$ whenever $|x - y| < \delta$.
To choose $\delta$, let
\begin{align*}
D_1 = \left\{ d_i \; \Big| \; \frac{1}{i} \ge \epsilon, d_i < x \right\}
D_2 = \left\{ d_i \; \Big| \; \frac{1}{i} \ge \epsilon, d_i > x \right\}
\end{align*}
Then $D_1$ and $D_2$ are finite, which means
they have minimum and maximum elements.
We have $\max D_1 < x$ and $\min D_2 > x$.
Let $\delta = \min(x - \max D_1, \min D_2 - x)$.
Show that $(x - \delta, x + \delta)$ is entirely disjoint from the sets $D_1$ and $D_2$.
Conclude that for all $d_i \in (x - \delta, x + \delta)$,
$\frac{1}{i} < \epsilon$, i.e., $f(d_i) < \epsilon$.
Therefore, for all $y \in (x - \delta, x + \delta)$, $|f(x) - f(y)| < \epsilon$.
The above answer is not great because I forgot that $f$ has to be monotone.
A better answer:
In the same vein as your solution mentioned in the comments, let
$D = \{d_1, d_2, d_3, \ldots\}$, and define
$$
f(x) = \sum_{d_i < x} \frac{1}{i^2}
$$
Then you can do the exact same solution you did in the case that $D$ is the rational numbers.