The Panthers have gone on a run in the past few weeks to pull within one point of the final wild-card spot in the East.
"Thomas is a proven scorer in this league who will add some offensive savvy and experience to our young group of forwards," Panthers president of hockey operations Dale Tallon said in a statement. "We believe strongly in our group and we're confident that he will help our power play and supplement our core effectively."
If the Panthers make the playoffs, the pick goes from Florida's third-rounder in 2017 to Arizona's third-rounder that the Panthers acquired in the Lawson Crouse trade during the summer.
Vanek leads the Red Wings with 15 goals despite missing almost a month of the season in November after going on long-term injured reserve with a lower-body injury.
He will be a free agent following the season after signing a one-year, $2.6 million deal with the Red Wings this past offseason. Detroit retains 50 percent of Vanek's remaining salary and salary-cap hit.
McIlrath, a 24-year-old defenseman, has played five games with the Panthers this season, scoring one goal. He also played one goal for the New York Rangers but was traded in November for Steven Kampfer.
Information from ESPN's Pierre LeBrun and Craig Custance and The Associated Press contributed to this report.