Sometimes it is forced. No other move prevents loss. Other than that there is no general answer. It all depends on the specifics of the position, whether you are creating a luft, playing h3 to discourage a knight or bishop from coming to g4, or playing g3 to blunt an attack on the b8-h2 diagonal or the g-file, or whether you are launching the pawns in front of your king into an attack.
There is no alternative to developing your chess sense and chess vision through extensive study. Simple rules don't work. And if they did chess would not be interesting.
1) Always hear, don't move pawn in front of king, but seem sometime you must or it is ok. When is this? (already castled exs) Like for White, move h3...when this is ok? Sorry don't have exact ex but when is times one should move pawn in front of King?
2) Also, if you want to creat space for King and not get back rank mate, which pawn should move to creat space for King, say if King is hiding on left side board and three pawns in front...best to move far left? or middle pawn? or pawn on right? (seem to me, far on left?)
I know depend on positions but in general, is there answers?