In my opinion, manipulations involving $\hat p$ and position bras and kets are most easily done by considering the action of $\hat p$ on the position bras, which is simply
$$
\boxed{
\vphantom{\begin{array}{}make\\the box\\taller\end{array}}
\quad\,\,\,
\langle x|\hat p=-i\hbar\frac{\text d}{\text dx}\langle x|.
\quad\,\,\,}
\tag 1
$$
You can get this easily by seeing that for any state $|\psi\rangle$ with position-representation wavefunction $\psi(x)=\langle x|\psi\rangle$, the action of the momentum operator on the state gives a derivative on the wavefunction. That is, $$\langle x|\hat p|\psi\rangle
=-i\hbar\frac{\text d}{\text dx}\langle x|\psi\rangle.$$
Since this equation holds for all states $|\psi\rangle\in\mathcal H$, you can "cancel $|\psi\rangle$ out". (More technically, since the action of the bras $\langle x|\hat p$ and $-i\hbar\frac{\text d}{\text dx}\langle x|$ is the same for all vectors, they must be equal as linear functionals.)
As you suggest, $u=g(x)$, taken invertible, and
$$
[\hat u, \hat x]=[\hat A, \hat x]=[\hat u, \hat A]=0,\\
\hat u \equiv g(\hat x), ~~~\leadsto |u\rangle \propto |x\rangle ~~~\leadsto \hat u |x\rangle = g(\hat x)|x\rangle = g(x)|x\rangle .
$$
Likewise,
$$
\hat A |x\rangle= f(x) |x\rangle= f(g^{-1}(\hat u)) |x\rangle \leadsto \\
\hat A |u\rangle= f(g^{-1}( u)) |u\rangle .
$$
In your sibling question you seem to appreciate that $\psi(x)$ does not "evolve" unitarily to $\psi (u)=\psi(g(x))\equiv \tilde \psi(x)$, since
$|\psi\rangle$ and $|\tilde \psi\rangle$ have different normalizations--see example below.
Let's illustrate some of this with the trivial scaling case g(x)=ax suggested in the sibling question, so g'=a, so du=a dx.
$$
{\mathbb I}=\int \!\!dx~~ |x\rangle \langle x|= \int \!\!du~~ \frac{1}{a}|x\rangle \langle x| \\
=\int \!\!du~~ |u\rangle \langle u| ,
$$
That is, $|u\rangle=\frac{1}{\sqrt{a}}|x\rangle$.
You then have,
$$\psi(u)=\langle u|\psi\rangle =\frac{1}{\sqrt{a}}\langle x|\psi\rangle= \psi (x)/\sqrt{a} =\langle x|\tilde \psi\rangle=\tilde \psi(x)=\psi(ax),\\
|\tilde \psi\rangle= |\psi\rangle / \sqrt{a} ~~~\implies ~~~
\langle \tilde \psi | \tilde \psi \rangle = \langle \psi | \psi \rangle/a,
$$
as remarked at the beginning. For this trivial case (only), the two expectation values you are computing turn out to be equal, but this is not a general feature, of course!
You may take it from here,
$$|\tilde \psi\rangle= \frac{1}{\sqrt{g'(\hat x)}}|\psi\rangle, ~~ |u\rangle= {1\over \sqrt{g'}}|x\rangle\leadsto \\ \frac{\langle\psi|\hat{A}|\psi\rangle}{\langle\psi|\psi\rangle}
= \int\!\! du |\psi(u)|^2 f(g^{-1}(u)) , ~~\mathbf{ but}\\
\frac{\langle\tilde\psi|\hat{A}|\tilde\psi\rangle}{\langle\tilde \psi|\tilde \psi\rangle}
= {\int\!\! {du\over g'(g^{-1}(u))} |\psi(u)|^2 f(g^{-1}(u)) \over \int\!\! {du\over g'(g^{-1}(u))} |\psi(u)|^2 }~~,
$$
as stressed! Check their identity for simple scaling, as per above remark.
Best Answer
Typically we define the notation $\langle x|\hat \Omega(t) | x'\rangle \equiv \Omega(x,x',t)$, where $\hat \Omega(t)$ is a (generally time-dependent) abstract operator and $\Omega(x,x',t)$ is an operator which acts on wavefunctions in the position basis. A common example is the momentum operator: $$\langle x|\hat P|x'\rangle = \delta(x-x') \frac{\hbar}{i}\frac{d}{dx'}$$
As a result, $$\frac{d}{dt}\langle x|\hat\Omega(t)|x'\rangle = \langle x |\frac{d\hat\Omega(t)}{dt}|x'\rangle \equiv \frac{\partial}{\partial t}\Omega(x,x',t)$$
It should also be noted that we can differentiate abstract operators without moving to a basis. The operator $\frac{d}{dt}\hat\Omega(t)$ is the operator such that
$$\frac{d\hat\Omega}{dt}|\psi\rangle = \lim_{\epsilon\rightarrow 0} \frac{\hat \Omega(t+\epsilon)|\psi\rangle-\hat\Omega(t)|\psi\rangle}{\epsilon}$$ We can evaluate this in a basis if we wish, but there's no particular need to.