Consider a Lagrangian for a scalar field $\phi$ with an interaction term $$\mathcal{L}_{int} = (\partial^2 \phi)^2 \phi.$$ Here I'm suppressing all indices for brevity. Now, this is just a three-point interaction with some extra momentum factors, so there seems to be no problem writing down the Feynman rule.
However, actually trying to carry out the procedure with canonical quantization looks tricky. The interaction term can't be written as a function of $\phi$ and $\partial \phi$, even if you use integration by parts, so we must let the Lagrangian have $\partial^2 \phi$ dependence. But then I don't know how to produce the Hamiltonian, because that's based on a Legendre transformation from $(\phi, \partial \phi)$ to the fields and momenta $(\phi, \pi)$. The new dependence on $\partial^2 \phi$ seems to totally mess this up; I don't know how to handle it in classical mechanics, let alone QFT!
How do you actually obtain the Feynman rule for this interaction, in canonical quantization?