Let $k$ be a field of characteristic zero and $f \in k[x]\setminus\{0\}$.
Let $R_f=k+\langle f \rangle$.
Question 1: Is it possible to find a general form of $f \in k[x]\setminus\{0\}$ such that $R_f$ is a UFD?
For example, $R_{x^2}=k+\langle x^2 \rangle=k[x^2,x^3]$ is not a UFD: $x \notin R_f$ and $x^6=x^2x^2x^2=x^3x^3$.
Is it true that for $f$ separable (has different roots), $R_f$ is a UFD? Probably not? What about $g=x+x^2$? $h=x^2-1$?
Question 2: Similar question for the two-dimensional case, namely, when $S_{f,y}=k+\langle f,y \rangle \subseteq k[x,y]$ is a UFD?
'Again', $S_{x^2,y}=k+ \langle x^2,y \rangle= k[x^2,x^3,y]$ is not a UFD.
Thank you very much!
As Mohan says, $R_f$ will be a UFD if and only if $\deg(f)\leqslant 1$. Indeed, if $\deg(f)\leqslant 1$ then $R_f=k[x]$, so the backwards direction is clear. For the forwards direction, suppose $R_f$ is a UFD, and assume for contradiction that $\deg f>1$; then $f=a_0+a_1 x+\dots +a_n x^n$ for some $n>1$ and $a_n\neq 0$. We may assume without loss of generality that $a_n=1$, since $f$ and $a_n^{-1}f$ generate the same ideal in $k[x]$. In particular, the element $x\in k[x]$ is integral over $R_f$, since $x$ satisfies the monic polynomial $$t^n+a_{n-1}t^{n-1}+\dots+a_1t+(a_0-f)\in R_f[t].$$ On the other hand, note that $xf$ lies in the ideal $\langle f\rangle<k[x]$, so $xf\in R_f$, and so $x=\frac{xf}{f}\in\operatorname{Frac}R_f$. Since UFDs are integrally closed, this means $x\in R_f$, and hence $x=\lambda+gf$ for some $\lambda\in k$ and $g\in k[x]$. If $g$ is $0$ this is clearly a contradiction, and if $g$ is non-zero then we have $$1=\deg(x-\lambda)=\deg(gf)\geqslant \deg(f)=n>1,$$ again a contradiction, so we are done. Essentially an identical argument works for $S_{f,y}$.
As @user26857 point outs, really what this shows is the stronger fact that $R_f$ is not even integrally closed unless $\deg(f)\leqslant 1$.