To factor $ 3x+9+xy+3y $ we can use factoring by grouping.
Group $ \color{blue}{ 3x }$ with $ \color{blue}{ 9 }$ and $ \color{red}{ xy }$ with $ \color{red}{ 3y }$ then factor each group.
$$ \begin{aligned} 3x+9+xy+3y &= ( \color{blue}{ 3x+9 } ) + ( \color{red}{ xy+3y }) = \\ &= \color{blue}{ 3( x+3 )} + \color{red}{ y( x+3 ) } = \\ &= (3+y)(x+3) \end{aligned} $$