Checkmates on g7 (for white) or g2 (for black) are less common than those on h2/h7, because they tend to require more manoeuvering of the pieces to achieve, but they can be more dangerous because it is less easy for the king to escape. Let's look at some examples.
Checkmates on g2/g7 most often occur when the g-pawn has moved or been captured, leaving holes in the defence for the attacking pieces to enter. A common scenario can be seen on the board below.
Even when the g-pawn hasn't been moved, the attack against g2/g7 can be dangerous. In this example, black takes advantage of the position of the white king on the g-file to bring a bishop into position to threaten checkmate.
The best piece for defending against this type of checkmate is the bishop, specifically the one that starts on the same side of the board as the king has castled to. By returning to its initial square, it can help add extra protection to the king's shelter.
For more information, why not try one of the suggested reading options below?