My version of the Peter-Weyl theorem says that if $G$ is a compact group, then the matrix coefficients of $G$ are uniformly dense in $C(G)$. Consequently, the matrix coefficients are also dense in $L^2(G).$
Consider the following fragment from Bump's book "Lie groups":
I have two questions:
(1) Why does the Peter-Weyl theorem imply that such a matrix coefficient $f$ exists?
I tried to construct some continuous function with Urysohn's lemma and then use the Peter-Weyl theorem to approximate this but I do not succeed in forcing $f(1)=0$. Maybe I should use a translation? How should I construct $f$?
(2) Why if $f$ is constant on the kernel of $\pi$, we have $\ker \pi \subseteq U$?
Maybe we can show that $f < 1$ on $\ker \pi$?

Building upon the OP's idea of using Urysohn's lemma the argument can be completed as follows.