How should Dirac notation be understood?

Physicists usually generously relax the condition that the norm should be finite and they sometimes say that $|\vec r\rangle,|\vec p\rangle$ belong to the "Hilbert space". It's exactly the same "generous" language that allows physicists to say that $\delta(x)$ is a "function", the delta-function, even though its values around $x=0$ are infinite or "ill-defined", so it's not really a function.

Rigorously mathematically, those objects don't belong to the Hilbert space (because their norm isn't finite) but (in analogy with the concept of "distributions" that include "functions" like $\delta(x)$) there exists a mathematical concept that includes such non-normalizable vectors, the rigged Hilbert space.

https://en.wikipedia.org/wiki/Rigged_Hilbert_space

The idea that is that one may define a subspace $\Phi$ of the Hilbert space that contains smooth enough functions. The dual space to the Hilbert space $H$ is $H$ itself. But the dual space to the subspace $\Phi$ is $\Phi^*$ that is, on the contrary, larger than $H$, and it's this $\Phi^*$ that is called the rigged Hilbert space and that contains objects such as $|\vec r\rangle$. Formally mathematically, the whole triplet $(\Phi^*,H,\Phi)$ is usually referred to as "the rigged Hilbert space".