Let $A$ be a unital $C^*$-algebra and assume that $a,b\in A_+$ are positive elements with $a\in\text{Her}(b):=\overline{bAb}$. Is it true that we can find a positive, continuous function $f\in C(\sigma(b)\cup\{0\})$ such that $f(0)=0$ and $a\le f(b)$ ?
Thoughts: First note that in case $b$ is invertible, this is easily seen to be true: write $a=\lim_n ba_nb$, so $b^{-1}ab^{-1}=\lim_na_n$. In particular $(a_n)$ is bounded, say $\|a_n\|\le M$, so $ba_nb\le Mb^2$ and taking limits yields $a\le Mb^2$, so we can take $f(t)=Mt^2$.
Also note that in the case that $b$ is a projection this is trivially true: then $\text{Her}(b)=bAb$ is unital with unit $b$, so $a=bab\le\|a\|b$.
At first, I had this question formulated for $f(t)=Mt$, i.e. can we find $M\ge0$ such that $a\le Mb$? Well, this fails easily: in $A=C[0,1]$, take $a(x)=x$ and $b(x)=x^2$. We have $a\in\text{Her}(b)$, but if $a\le Mb$, then $x\le Mx^2$ for all $x\in[0,1]$ and thus $\frac{1}{x}$ is bounded near $0$, which is false. But note that this is not a counter-example to the original question, since if we set $f(t)=t^{1/2}$ we do have $a=f(b)$ (thus $a\le f(b)$).
Added later: What might be a useful observation is this. Note that $\text{Her}(f(b))=\text{Her}(b)$. Indeed, we have $b\in\text{Her}(b)$ and since this is a $C^*$-algebra we have $f(b)\in\text{Her}(b)$ and thus $\text{Her}(f(b))\subset\text{Her}(b)$. On the other hand, since $f(t)\ne0$ for all $t\ne0$ we have that $\text{supp}(f^2)=\text{supp}(\text{id}_{\sigma(b)})$ (the open supports) and therefore we can find a sequence $(r_n)\subset C(\sigma(b))$ with $r_n(0)=0$ such that $\text{id}_{\sigma(b)}=\lim_n r_nf^2r_n^*=\lim_n f|r_n|^2f$. But then $b=\lim_n f(b)\cdot|r_n|^2(b)\cdot f(b)\in\text{Her}(f(b))$, so $\text{Her}(b)\subset\text{Her}(f(b))$. More on this here.
Edit 2: The problem is also easily resolved if $0\in\sigma(b)$ is an isolated point. Then we have some $\varepsilon>0$ such that $\sigma(b)\subset\{0\}\cup[\varepsilon,\|b\|]$. Set $f(0)=0$ and $f(t)=1$ for $t\in\sigma(b)\cup[\varepsilon,\|b\|]$. Then $f(b)$ is a projection and $a\in\text{Her}(b)=\text{Her}(f(b))$ so $a\le\|a\|f(b)$. So the only case left is when $0\in\sigma(b)$ is not an isolated point.