The simplest way to verify an identity like $a^3-b^3=(a-b)(a^2+2ab+b^2)$ is to multiply out the righthand side and verify that you do indeed get the lefthand side. If you try it in this case, however, you’ll fail:
$\begin{align*} (a-b)(a^2+2ab+b^2)&=a(a^2+2ab+b^2)-b(a^2+2ab+b^2)\\ &=\left(a^3+2a^2b+ab^2\right)-\left(a^2b+2ab^2+b^3\right)\\ &=a^3+2a^2b+ab^2-a^2b-2ab^2-b^3\\ &=a^3-b^3+\left(2a^2b-a^2b\right)+\left(ab^2-2ab^2\right)\\ &=a^3-b^3+a^2b-ab^2\;, \end{align*}$
and $a^2b-ab^2=ab(a-b)$ certainly isn’t guaranteed to be zero. (It’s zero if and only if either $a=0,b=0$, or $a=b$.) Thus, in general $a^3-b^3\ne(a-b)(a^2+2ab+b^2)$. The correct identity is $a^3-b^3=(a-b)(a^2+ab+b^2)\;,$ as you can check by multiplying out the righthand side: this time everything will cancel out except $a^3-b^3$.
The trick to factorizing an expression like $(3x + 1)^2 - (x+3)^2$ is to recognize that it has the form $a^2-b^2$, where $a=3x+1$ and $b=x+3$, and to recall the basic factorization formula $a^2-b^2=(a-b)(a+b)\;.$
A few of the standard basic formulas can be found here, together with a link to a practice page. Here is the start of a set of three pages on the topic, with examples. Googling on factoring formulas, with or without quotes, will turn up many more such resources.