Not only is that illegal, but is completely stupid if it was legal.
four move mate help please

3. ... Nc6 is a reasonable developing move, but doesn't address the immediate concern. After 3. Qf3, I'd probably play 3. ... d6 immediately, preparing Bg4 next, and preventing 4. g4.

I often run into the problem below.
[Site "Chess.com iPhone"]
[Date "03/14/2020 09:19PM"]
[White "White (0)"]
[Black "Black (0)"]
1.e4 e5 2.Bc4 Nf6 3.Qf3 Nc6 4.g4 d6 5.g5
Thank you!!
From the moves you gave, what do you think white's idea is with the move 5.g4?

If he sees the idea is to remove the knight from blocking the attack on f7, then it's time to think of ways to deal with it.
It's incorrect for him to say "no matter what I do"
My point is he should identify the threat, find moves that deal with the threat, and the choose the move that deals with it in a way that he thinks is best.
Perhaps it would be a good idea to look at Discovering Chess Openings
https://web.archive.org/web/20140627114655/http://www.chesscafe.com/text/hansen91.pdf
and/or First Steps: 1 e4 e5.
https://www.newinchess.com/media/wysiwyg/product_pdf/7790.pdf
https://chesscafe.com/book-reviews/first-steps-1-e4-e5-by-john-emms/
In both books, GM Emms gives this game.
From Winning Chess Openings:
I often run into the problem below.
[Site "Chess.com iPhone"]
[Date "03/14/2020 09:19PM"]
[White "White (0)"]
[Black "Black (0)"]
1.e4 e5 2.Bc4 Nf6 3.Qf3 Nc6 4.g4 d6 5.g5
Thank you!!