Avoiding Stalemate with Queen and King only

When you get the opponent King on the edge of the board just keep your Queen on the files in the middle (d and e files) on the rank next to the edge (2nd and 7th rank). Say the opponent King is on the 8th rank and on the g or h file. Keep your Queen on the 7th rank and on the e file but NOT on the f file. This way the opponent can and must move their King back and forth between g8 and h8. You bring your King to g6 and then finish the game with Qg7#. Simple enough.

put the king in a box and then move your king over to the rank the king is in then move the queen to last rank and checkmate the king with queen supported by king

This is how i do it:
1. Use the queen to create a box the king cant escape. Try to box it in where there are no other pieces.
2. Move away any pieces that are currently looking into the square, such as bishops from across the board. You may even sacrifice them by moving them next to the king.
3. Put the queen so that it is 2 squares away in one direction and 1 square away in another (like how a knight moves). Wait for the king to move and just imitate it. Trap it towards the edge of the board whenever u can. Be very careful to not stalemate in the corner.
4. move your king up and finish them.
There will still be ways to stalemate, but this is a methodical approach that keeps it simple.

Queen and king only?
The known way to checkmate with a queen and a king is to put the queen and enemy king in an L-shape until the king’s forced into the very corner and the square next to it (don’t bring your queen over or it’s stalemate)- then bring your king over until it protects a square where the queen could go over to checkmate the king. Like this: