Contacting a professor in the university you are applying
Only contact professors if you are genuinely interested in working with them and can demonstrate that you might be a good fit. Profs get a lot of generic cold emails so it isn't worth it if you aren't excited about them specifically.

But if you see someone's work that really does interest you, then definitely reach out! In a short email, use a few sentences to demonstrate that you are interested, know what they actually do (take a look at a few of their papers), and why you are a good fit (relate your experiences to their work).