Hello, thank you for taking the time to post your question!
It just depends on the type of quadratic that you are dealing with! The quadratic formula works for all functions that begin with x^2, so it’s most useful when you have roots that are not nice and neat. Factoring is great when you expect the answer to have simple integer values and you see a way to neatly factor it out.
So if you think the equation will have nice roots, you can try to factor. If you think the factoring could get messy or are unsure how to approach factoring, the quadratic formula is a great choice.
I hope that helps get you moving in the right direction! Feel free to reach out if you still have questions beyond that :)