I made two sentences:
1. "They did not pay any attention"
2. "They paid no attention"
Q1: Are they both correct?
Q2: What's the difference between these two sentences.
Q3: Which expression is better and when to use it?
The two sentences are both valid and good English. Both are commonly used by fluent speakers. They mean pretty much the same thing. I haven't checked any statistics, but I'd guess that #1 is more common. #2 sounds a little more formal. But either is fine.