If engine shows mate in 5, it will also show that .Bd7 does not work after blacks defense ..Be7.
Mate in 5
1. g5+ Kh5 2.Kh3 (Here you failed to see blacks best move ) Be7
Now to mate in 5 you must play 3. Rxe7
If you play 3. Bd7 Bxg5
Now your bishop is in the way of your rook, and should you play 4. B4+ Kh6 and your unable to mate in 5.
edited - Oh well, all ready answered.
White to move. Engine shows mate in 5. But I did it in 4. G5, kH3, bD7, bG4. How can black force 5th move?