What is the idea behind this move? I was watching Nepomniachtchi - Liren match on Chess24 Legends Day 2. After having a pretty significant advantage [+7.1 (Stockfish 11)], White [Nepo] has played g4, and according to the engine, the game could be drawn by something sort of perpetual checks or three-fold repetition,

Since after g5+, Kh5; Black can make his king pretty safe in the pawn structure and also its active queen bishop combo can neutralize white's attack by giving perpetual checks; so my question is:
What is the idea behind the move g4 in this situation?
First of all, I do not think Black's king would be safe at all on h5. After Kh5 simply Rd4 would threaten Bf3#. Many other concrete threats also come to mind with the king on h5, but the idea is the same: the king is one check away from checkmate, since no squares are available for him. Of course all of this is ignoring the fact that Black can force a draw.
I believe g4 is simply an overlook (yes, they happen in the elite too). Nepo was probably too enthusiastic about the threat of g5+ with all the subsequent mate threats after Kh5 that he overlooked the forced draw. So to answer your question: I think the idea behind g4 is simply to create a mating net against the enemy king. A strange overlook by such a strong player anyway.