Obviously various forwards have hit their peak anywhere from 19-20 (Jimmy Carson) to 30-31 (Martin St.Louis), but of course the average would be around 23-25. Defensemen and goalies, as noted, tend to peak a bit later, with lots of exceptions.
But I think, as someone said off the top, it's really more so the "mileage" that gets players, not the years. If you're a low-physical impact forward whose team misses the playoffs or gets bounced early every year, playing in a low-pressure small-city environment, and you're never considered the leader/go-to guy on your team by fans/teammates/media, you're much more likely to have a longer career with a later (or extended) peak than the guy who starts pro-hockey at 18 under huge pressure and has lots of long playoff runs all through his 20s, etc. The latter guy is bound to burn out earlier, or have more injuries as he ages, etc.
I think this is why, in earlier eras, we saw players like Guy Lafleur or Bryan Trottier suddenly decline rather precipitously. It wasn't that they had peaked earlier; it was just that they had a lot of mileage after all those playoff runs. Winning 4 straight Stanley Cups is like playing 1.5 more seasons in the same time period as someone who had less ice-time and whose team missed the playoffs each year. And that's not even getting into the increased pressure and psychological impact of being on a high-profile team.
However, there are always outliers who defy these general trends: Gordie Howe, Larry Robinson, Chelios, Jagr....