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