we haven't used D=5 as such. what we've used is that $De^{5x}=5e^{5x}\implies D^2 e^{5x}=5^2 e^{5x}$ and so forth
so $D\neq 5$ when acting on arbitrary functions, but $D$ does behave like "multiplication by 5" when acting on $e^{5x}$
this is easy enough to justify at the level of $(D-2)e^{5x}=3e^{5x}$
the 'operator series' method is where things get dicey in terms of rigour