The Hamiltonian may depend on time, which means you do not have a simple operator equation. The Hamiltonian itself does not depend on position. The Hamiltonian is an operator. It's not a function.
Let's take the example of a time-independent Hamiltonian. This can be written in the form of an operator:
$$\hat H = -\frac{\hbar^2}{2m}\hat D^2 + \hat V$$We have used ##\hat D## to denote the differential operator and ##\hat V## to represent the operator generated by multiplication by some (potential) function ##V##.
The action of this operator on a function, ##\psi## is:
$$\hat H\psi = -\frac{\hbar^2}{2m}\hat D^2\psi + \hat V\psi$$Finally, we can use ##x## and ##t## as the position and time variables for our functions and express this equation for every point ##x## and time ##t##:
$$(\hat H\psi)(x, t) = -\frac{\hbar^2}{2m}\frac{\partial^2\psi}{\partial x^2}(x, t) + V(x)\psi(x, t)$$If the potential is also a function of ##t##, then we have a time-varying equation:
$$(\hat H\psi)(x, t) = -\frac{\hbar^2}{2m}\frac{\partial^2\psi}{\partial x^2}(x, t) + V(x,t)\psi(x, t)$$In this case, you could write the Hamiltonian itself as a function of time:
$$\hat H(t) = -\frac{\hbar^2}{2m}\hat D^2 + \hat V(t)$$