I know that both can mean "correct". I frequently hear things like "合ってる？" to mean :"is it right?" I don't know much about the use of 正しい, but I know that it's also a common word for "correct".
What would be the difference between the two? Is there a preference for one over the other in certain situations and formality levels?