I'm not sure where your Hilbert space misconceptions are, but you've definitely made a hash out of phase-space quantization. In Hilbert space, $$ \hat A = \int\!\! dx dy~ |x\rangle \langle x| \hat A |y\rangle \langle y| , $$ where the matrix elements $\langle x| \hat A |y\rangle $ are indeed functions of two *x,y* coordinates. Let's stick to the expression of all operators in coordinate space, even though you could easily Fourier transform to momentum space, avoided here, since it confuses you so. This is true for any operator including momenta, $$ \hat p = -i\hbar \int\!\! dx ~ |x\rangle \partial _x \langle x| , $$ so I would write such operators as $\cal {A}(\hat x, \hat p)$, where $\hat x$ and $\hat p$ are in a nontrivial ordering you must specify, but which is normally unambiguous in simple QM problems not involving angular momenta or exponentials of operators. That is to say, $$ \langle x| \hat p|y\rangle= -i\hbar \partial_x \delta(x-y) ~~~\leadsto \\ \langle \psi|\hat p|\psi\rangle = -i\hbar \int\!\! dx \psi^*(x) \partial_x \psi(x). $$ I have no access to your text, but, as your instructor should have explained to you, patiently, $p(x)$ is not a function of *x*, but, instead, a non-diagonal operator, as you see above, acting on functions of *x* and not commuting with *x*. You are struggling against bad notation, which your text might/should have clarified. The [Wigner map](https://en.wikipedia.org/wiki/Wigner–Weyl_transform) of such operators is a function of two c-number parameters, in phase space. $$ A(x,p)= 2\int\!\!dy ~ e^{-2ipy/\hbar}~\langle x+y|\hat A| x-y\rangle . $$ This map is invertible to Hilbert space operators by the Weyl map from phase space to Hilbert space, producing an operator equivalent to the original $\cal {A}(\hat x, \hat p)$, in a special ordering, achievable from the original through Heisenberg's commutation relations. In this vademecum [booklet](https://www.hep.anl.gov/czachos/aaa.pdf) you may work out through its exercises this full-circle garland of transformations.