It's perfectly fine to use syntax or other features from newer versions of the language.
That said, it doesn't hurt to be explicit about which newer syntax or feature your solution depends on, especially for very recent versions which many people will not have upgraded to yet. In that case your answer may also be improved by writing an alternative for people using an older version of the language. I wouldn't recommend writing only for an older language version just because the newer version is new; it won't be new for long, and your answer is meant to stay useful in the future (that's Stack Overflow's whole purpose).
For an example where specifying the version is actually necessary, some people write python answers which take advantage of dictionaries having insertion order, which has been guaranteed since Python 3.7. In these answers, it is actually necessary to explain that the solution only works for 3.7+, since the code will run without errors on older versions, just with incorrect results (due to dictionaries having different, implementation-dependent iteration orders in older versions).