Gibson made five saves before leaving with an upper-body injury. He was replaced at the start of the second period by Stolarz who allowed two goals on 10 shots before leaving with a lower-body injury. Hodges entered the game at the start of the third and made two saves on three shots.
Thomas Harley and Joel Hanley scored, and Jake Oettinger made 19 saves for Dallas (46-30-6), which won three of its last four regular-season games (3-0-1).
The Stars moved one point ahead of the Nashville Predators for the first wild card with the win, and clinched after the Predators lost 5-4 to the Arizona Coyotes. Dallas will face the Calgary Flames in the Western Conference First Round, beginning on Tuesday.
Max Comtois and Troy Terry scored for Anaheim (31-37-14), which ended the regular season with one win in its final five games.
Comtois gave the Ducks a 1-0 lead at 7:33 in the first period after the puck went off him and Dallas defenseman Esa Lindell before bouncing past Oettinger.
Harley tied it 1-1 at 3:13 in the second period with his first NHL goal. The defenseman skated down the slot and used Stars forward Denis Gurianov as a screen to score high glove side.
"A [heck] of a lot of relief," Harley said about scoring his first goal. "I didn't score all year, down in the [American Hockey League] and up here. It's definitely something that's been weighing on my mind. I don't usually celebrate like that, usually it's just like a little fist bump or something, but I was pumped up."
Hanley gave Dallas a 2-1 lead at 5:45 on a slap shot from the high slot.
"I think as a team, we wanted to go into playoffs feeling good about ourselves," Hanley said. "I think a win will go a long way. Feeling good about ourselves and trying to get our game ramped up for the playoffs."
Terry tied it 2-2 at 15:41 after Adam Henrique found him with a no-look, between-the-legs backhand pass from behind the net.
"It's no secret that it was hard around here the last couple weeks," Terry said. "I think we've got a lot of young guys that really came into their own this year. We've got a lot of older guys that stepped up from previous years and found their games. It's just such a fun group to be part of. We really found something this year, and we're excited to go into next year with that confidence and a fresh start."