“Doctor Sleep” is a bracingly contemplative horror film that manages to make its case for being a worthy sequel to both Stephen King and Stanley Kubrick’s “The Shining.”

The film focuses on Dan Torrance, played by Ewan McGregor, as he eventually overcomes his trauma from the horrific ordeal he had endured at the Overlook Hotel as a child. He now works in a hospice in New Hampshire, where he comforts its dying patients with his “shine” abilities that earn him his titular nickname. Danny later comes into contact with Abra, played by Kyliegh Curran, a teenage girl who has more powerful shine than his. She enlists his help in defeating the True Knot, a predatory, quasi-vampiric cult led by Rebecca Ferguson’s merciless Rose the Hat who brutally feed off psychic kids who also possess shine abilities for their immortality. It then becomes a cross-country trek to supernatural danger and possible redemption on behalf of Danny, as the three brace toward an inevitable showdown.

McGregor earns his spurs as the main character, played by Danny Lloyd in Kubrick’s film (and who has a cameo as a chatty spectator in a baseball game). He manageably makes sense of his portrayal as a despairing alcoholic who eventually overcomes his addiction, which is one of many characteristics of director Mike Flanagan that makes “Doctor Sleep” steer away from Kubrick’s detached tone in “The Shining”. Curran’s command of her character is impressive for her first film role, as she straddles the path between scared victim and confident badass. But it is Ferguson that shines the most, as her villain comes off as terrifying while at the same time fascinating.

At first glance, “Doctor Sleep” feels like an episode of Netflix series “The Haunting of Hill House”, also directed by Flanagan. People who loved Kubrick’s coldly atmospheric adaptation of “The Shining” may find themselves disappointed in this film. But for the open-minded cinephiles, it is actually a refreshing case study for how Flanagan delivers when not relying too much on what made “The Shining” iconic across horror film circles. There is always an eerie air hazed with visually muted color palettes floating throughout the film. There are some disturbing scenes that will test the uninitiated viewer’s endurance for nightmares. Nevertheless, Flanagan’s penchant for uneasy optimism, which happens to share King’s vision for the source material, makes “Doctor Sleep” stand out on its own.

For most of the film, that is. A sequel to a landmark horror film such as “The Shining” inevitably has to check that mark of consideration. Slight spoilers aside, “Doctor Sleep” returns to the Overlook Hotel in what may be a potentially divisive final act. Some may find it playfully nostalgic, while others may find it bordering on sacrilege. What is unmistakable, though, is that the film at this point struggles to live up to the imposing monolith that is “The Shining”, even if the painstaking recreation of the iconic hotel is downright impressive by Kubrickian standards. Still, Flanagan pulls off some smart tricks that only just redeem “Doctor Sleep” by the time the credits roll.

While the film’s runtime might make it seem a bit of a drag even by the standards set forth by the equally long “The Shining”, it still possesses a hauntingly potent quality that is worth checking in for. Flanagan makes King and Kubrick’s conflicting legacies work quite well by adding his signature touch. The resulting imperfect hybrid shows Flanagan’s talents as a hopeful and compelling filmmaker. Moreover, “Doctor Sleep” delivers as a doable treatise on how people wracked with PTSD caused by all forms can still shine on in the end.