The problem lies on the notation. The state $|\psi\rangle$ is not exactly equal to the eigenfunction $\psi(x)$.
The eigenfunction $\psi(x)$ is formally defined to be the projection of the state to the position basis $|x\rangle$ i.e. $$ \psi(x)=\langle x|\psi\rangle $$
Therefore the eigenstates $|\psi\rangle$ are not "functions" of position. Similarly, the operators can be represented as differential operators, but a more correct way of doing so is as follows. For this example I am using the momentum operator in the position representation:
Let $|x\rangle$ and $|y\rangle$ be two orthonormal states in the position basis. 66
We note that $[X,P]=i\hbar$, therefore $$ i\hbar\langle x|y\rangle = \langle x|[X,P]|y\rangle=\langle x|XP|y\rangle-\langle x|PX|y\rangle=(x-y)\langle x|P|y\rangle $$ Since $\langle x|y\rangle=\delta(x-y)$, then $$ \langle x|P|y\rangle=i\hbar\frac{\delta(x-y)}{x-y}\equiv i\hbar\frac{\partial}{\partial y}\delta(x-y) $$ Which is a property of the Dirac delta i.e. $\frac{\partial}{\partial y}\delta(x-y) = \frac{\delta(x-y)}{x-y}$. Therefore we see that
$$ \langle x|P|\psi\rangle=\int dy \langle x|P|y\rangle\langle y|\psi\rangle=\int dy \bigg(i\hbar\frac{\partial}{\partial y}\delta(x-y)\bigg)\langle y|\psi\rangle $$ $$ =\int dy i\hbar\frac{\partial}{\partial y}\delta(x-y)\psi(y)=-i\hbar\frac{\partial}{\partial x} \psi(x) $$ From this it is suitable to use the representation \begin{equation} P\longrightarrow -i\hbar\frac{\partial}{\partial x} \end{equation} As you can see, the operator $P$ in a more general sense is not equal to $-i\hbar\frac{\partial}{\partial x}$, thus the arrow instead of an equality. It is mere a representation.
Now that we have this information at hand, in truth when some books or lectures say $$ \frac{d}{dx}|\psi(x)\rangle\langle u(x)| $$ what they actually mean is $$ \bigg(\frac{d}{dx} \psi(x)\bigg)u(x) $$ Additional notes:
We can see the relationship of the momentum and the position bases states as $$ p\langle x|p\rangle=\langle x|P|p\rangle=-i\hbar\frac{\partial}{\partial x} \langle x|p\rangle $$ which is a first order partial differential equation, solving this gives $$ \langle x|p\rangle=\frac{1}{\sqrt{2\pi\hbar}}e^{\frac{ipx}{\hbar}} $$ i.e. the bases are Fourier transforms of each other $$ |p\rangle=\frac{1}{\sqrt{2\pi\hbar}}\int dx e^{\frac{ipx}{\hbar}}|x\rangle $$ $$ |x\rangle=\frac{1}{\sqrt{2\pi\hbar}}\int dx e^{-\frac{ipx}{\hbar}}|p\rangle $$ 955