Existence of a cut-off function I have a question about the existence of a "cut-off" function with a specific purpose:

Question. Let $g:\mathbb R\to \mathbb R$ be a locally bounded function. Does there exist a sequence of functions $(f_k)_{k\geq 1}\subset C^\infty_c(\mathbb R)$ such that $f_k\geq 0$ and $f_k\to 1$ almost everywhere and $g f'_k\to 0 $ uniformly on $\mathbb R$?

Alternatively, it is enough to find a bound of the form $|gf'_k|\leq a_k$ with $a_k\to 0$. In my attempt below, I try $a_k=Ck^{-1}$, but I fail.
My attempt.
One can easily construct a sequence $f_k\to 1$. Indeed, let $\varphi:\mathbb R\to\mathbb R$ be such that $\varphi(x)=1$ for all $|x|\leq \frac 1 2$ and $0$ if $|x|\geq 1$ and for $\frac 1 2 \leq |x|\leq 1$ a smooth transition from $1$ to $0$. So I tried to adapt this as follows:
$$f_k(x)=\varphi(x/k)\exp\left(-b_kx^2\right)$$
for some sequence $(b_k)_{k\geq 1}$  to work against the supremum of $g$ on $\{|x|\leq k\}$. Let us differentiate and see what happens
$$ f_k'(x)=\left(\frac 1 k  \varphi'(x/k) -2b_kx \right)\exp\left(-b_kx^2\right)$$
Of course $\| \varphi'\|_\infty<\infty$. So for instance to ensure $|g f_k'|\leq k^{-1}C$, I thought maybe I can start with trying to get
$$\frac 1 k \|\varphi'\|_\infty |g(x)|\exp(-b_kx^2)\leq Ck^{-1}, \ \  \ \text{ on } \{k/2\leq |x|\leq k\},$$
becaue $\varphi'$ is zero on $k/2\leq |x|$. But  at the same time I also need to have
$$2|b_kxg(x)|\exp\left(-b_kx^2\right)\leq Ck^{-1}, \ \  \ \text{ on } \{|x|\leq k\}.$$
I think it is difficult. Even when $g$ has linear growth, like $|g(x)|\leq M(1+|x|)$. The problem is, if you ensure the first inequality, you cannot ensure the other inequality.
Other than this, I know there are many localization functions in PDE theory, but I could not find the one for my purpose. I would appreciate if one has a reference for an example. Also, if it is difficult, can we do it for $g$ with linear growth?
Note. My approach works if $|g(x)|\leq M(1+|x|^\alpha)$ with $\alpha\in [0,1)$ by taking $b_k\equiv 0$. This is, unfortunately, the best I could achieve.
Short motivation. This problem arises in localizing coefficients from diffusion operator to prove a result on equality of one-dimensional distributions of SDEs with locally bounded coefficients. It is very long proof and I am stuck with this little technical result.
 A: I claim this is not true in general. For this consider
$$ g(x) = (1+|x|^{1+\varepsilon}) $$
for any $\varepsilon > 0.$ The main point is that
$$ A(\varepsilon) := \int_0^{\infty} \frac1{g(x)} \,\mathrm{d}x < \infty. $$
As you will see, this argument works more generally for any non-negative $g$ whose reciprocal is integrable.
Suppose there is a sequence $f_k \in C^{\infty}_c(\Bbb R)$ such that $f_k \to 1$ almost everywhere and $gf_k' \to 0$ uniformly in $\Bbb R.$ Then we know there is some point $x_0 \geq 0$ where $f_k(x_0) \to 1$ as $k \to \infty.$ Then there is $k_0$ such that for all $k \geq k_0$ we have $f_k(x_0) \geq \frac12$ and
$$ g(x) |f_k'(x)| \leq \frac1{4A(\varepsilon)} $$
for all $x \in \Bbb R$ by uniform convergence. Then by the fundamental theorem of calculus, for all $x>x_0$ we have
\begin{align*} f_k(x) &= f_k(x_0) + \int_{x_0}^x f'_k(x) \,\mathrm{d}x \\
&\geq \frac12 - \int_{x_0}^x |f'_k(x)| \,\mathrm{d}x \\
&\geq \frac12 - \frac1{4A(\varepsilon)}\int_{x_0}^x \frac1{g(x)} \,\mathrm{d}x \\
&\geq  \frac12 -  \frac1{4A(\varepsilon)}\int_{0}^{\infty} \frac1{g(x)}\,\mathrm{d}x\\
&= \frac14.
\end{align*}
Hence $f_k(x) \geq \frac14$ for all $x \geq x_0,$ so $f_k$ is not compactly supported. Hence no such sequence $(f_k)$ exists.

This shows that the result only holds if $g$ does not grow too quickly, and this is consistent with your working that shows it suffices to assume $|g(x)| \leq (1+|x|^{\alpha})$ for $\alpha \in (0,1).$ In the critical case of linear growth the result is also true; for this assume $|g(x)| \leq C(1+|x|).$
We will exploit the fact that
$$ \int_0^{\infty} \frac1{1+x} \,\mathrm{d}x = \int_1^{\infty} \frac{\mathrm{d}}{\mathrm{d}x} (\log (1+x)) \,\mathrm{d}x = \infty,$$
using the fundamental theorem of calculus. Then we can construct a sequence of piecewise smooth functions by setting
$$ \varphi_k(x) = \begin{cases}
  1 & \text{ if } |x| \leq k \\
  1+\frac1k\left(\log(2+k) - \log(2+|x|)\right) & \text{ if } k < |x| \leq e^k(2+k) -2 \\
  0 & \text{ if} |x| > e^k(2+k) -2. \end{cases}$$
Note that $\varphi_k$ is continuous and $|\varphi_k'(x)| \leq \frac1{k (|x|+2)}$ whenever $k < |x| < e^k(2+k)-2.$ We need to regularise $\varphi_k,$ so let $\rho$ be a mollifier supported in $(-1,1)$ and set
$$ f_k = \varphi_k \ast \rho \in C^{\infty}_c(\Bbb R).$$
We claim this sequence works; evidently $f_k \equiv 1$ on each $[-(k-1),k-1]$ so $f_k \to 1$ pointwise as $k \to \infty.$ Moreover since
$$|f_k'(x)| \leq C\, \operatorname*{ess \, sup}_{|y|\leq 1} |\varphi_k'(x+y)| \leq \frac{C}{k(|x|+1)} \chi_{k-1 < |x| < e^k(2+k)-2} $$
(by mollifying the $L^{\infty}$ function $\varphi_k'$) for $|x|>k-1$ we can estimate
$$ |g(x)f_k'(x)| \leq \frac{C(1+|x|)}{k(1+|x|)} = \frac{C}{k}. $$
Since $f_k'(x)$ vanishes for $|x| \leq k - 1,$ uniform convergence follows.

From the above we see there is a dichotomy dependent on the integrability of $1/|g(x)|;$ for $g(x) \sim (1+|x|^{\alpha})$ we see this occurs if and only if $\alpha \leq 1,$ but the criticality is not occuring at linear growth. For instance the above can be refined to hold if $g(x) = (1+|x| \log(1+|x|))$ by noting that $\frac{\mathrm{d}}{\mathrm{d}x}(\log \log x) = \frac1{x \log x},$ but I will omit the details here.
