I'm trying to prove the statement in the title, where $\hat{U}$ is a unitary operator. If I expand the function $f$: \begin{align} f(\hat{U}^\dagger\hat{A}\hat{U}) &=\sum_k f_k (\hat{U}^\dagger\hat{A}\hat{U})^k\\ &=\sum_k f_k\hat{U}^{\dagger k}\hat{A}^k\hat{U}^k. \end{align}
I would like to use the fact that $\hat{U}^\dagger\hat{U} = 1$ here to eliminate the $k$ power from the $U$ operator in the summation. I miss that step, since I would get
$$\sum_k f_k\hat{U}^{\dagger k}\hat{A}^k\hat{U}^k = \sum_k f_k\hat{U}^{\dagger}\hat{A}^k\hat{U} =\hat{U}^{\dagger}\left[\sum_k f_k\hat{A}^k\right]\hat{U} = \hat{U}^{\dagger}f(\hat{A})\hat{U}.$$
I don't know how to accomplish that step. Any hint will be appreciated.
There is a problem in the second line of your equation : you have $$(\hat{U}^\dagger\hat{A}\hat{U})^k\neq (\hat{U}^\dagger )^k\hat{A}^k\hat{U}^k,$$ since matrix multiplication is not commutative. Instead, you have $$(\hat{U}^\dagger\hat{A}\hat{U})^k = (\hat{U}^\dagger\hat{A}\hat{U})\cdot(\hat{U}^\dagger\hat{A}\hat{U}) \cdots(\hat{U}^\dagger\hat{A}\hat{U})=\hat{U}^\dagger\hat{A}^k\hat{U},$$ where the second equality comes from the fact that $\hat{U}\cdot \hat{U}^\dagger=1$. From there you can finish the proof.