To factor $ a^2-3a+ab-3b $ we can use factoring by grouping.
Group $ \color{blue}{ a^2 }$ with $ \color{blue}{ -3a }$ and $ \color{red}{ ab }$ with $ \color{red}{ -3b }$ then factor each group.
$$ \begin{aligned} a^2-3a+ab-3b &= ( \color{blue}{ a^2-3a } ) + ( \color{red}{ ab-3b }) = \\ &= \color{blue}{ a( a-3 )} + \color{red}{ b( a-3 ) } = \\ &= (a+b)(a-3) \end{aligned} $$