Hart was next selected to represent Canada at the 2017 World Junior Ice Hockey Championships. Brought in as the starting goaltender, he was sidelined after allowing three goals in 17 shots by Russia and was called up again only when Connor Ingram gave up two goals in three shots by Sweden. After making 31 saves in the gold-medal game against the United States, Hart gave up a shootout goal by Troy Terry to give Canada the silver medal. He was again chosen, with Michael DiPietro this time, for the 2018 World Junior Ice Hockey Championships. After recording a 23-save shutout against the Czech Republic in pre-tournament play, Hart was named Canada's starter. Canada defeated Sweden in the gold-medal match, and Hart ended the tournament with a 5–0–1 record, tying the Canadian world junior career record at 8–0–2.