Just to add to what's been said and to address the comment by @LightnessRacesinOrbit, you can indeed have perfectly good functions that are only defined on some subset of the real numbers. The reason the Dirac delta is not a function is not that it is only well-defined for some real numbers and not others; in fact, it is not defined as a function anywhere! It is instead defined as a sort of "hypothetical" function, call it $\delta(x)$, that, if it existed, would satisfy the property that when you integrated it against any other (sufficiently nice) function $f(x)$, you would get
$\int_{\mathbb{R}} \delta (x) f(x) \, dx = f(0) $.
There is no well-defined function that actually does this, but there are well-defined functions that come as close as you want: for example, functions we can call $\varphi_\varepsilon$ that are equal to zero everywhere except in a small interval $(-\varepsilon, \varepsilon)$ around zero, and are equal to $\frac{1}{2\varepsilon}$ for $x \in (-\varepsilon, \varepsilon)$. Notice that if $f(x)$ is smooth, then
$\int_{\mathbb{R}} \varphi_\varepsilon (x) f(x) \, dx \approx f(0) $.
So we can get close to having a function that behaves the way we want a Dirac delta to, but not quite (that equality is only approximate, because $f(x)$ may vary over the interval $(-\epsilon,\epsilon)$). Rather than a function, the Dirac delta is really a linear operator that takes in a smooth function and gives you back the value of that function at $x=0$. Notationally we still pretend that there is a "function" $\delta(x)$ that embodies this operation when you integrate other functions against it, but more properly it is an element of the so-called "dual space" to the space of smooth functions that are zero outside a bounded interval - that is, it is an element of the space of linear operators on such functions (as a technicality: note that it is a continuous linear operator with respect to the uniform norm on smooth functions of compact support).