Look up how to give a checkmate with queen and a king vs lone king. Decent video will also show how to not stalemate
How to avoid stalemate draw

You want to be in a position like this. Use your queen to trap the king on the edge of the board. Then get your king opposite the other king, and then you can move your queen in to get checkmate.

I also noticed that king can't go to the corner.
To go with the king to the corner is to force draw.
Put the queen in the middle of the side, as shown in your picture, indeed work.
I also noticed that king can't go to the corner.
To go with the king to the corner is to force draw.
Put the queen in the middle of the side, as shown in your picture, indeed work.
You answered your own question!

When he is trapped on one row along a side, walk the king up to deliver checkmate.

There are several ways to avoid ending a game in a stalemate position:
Understand the stalemate rule. A stalemate occurs when a player can't make any legal moves to a safe square, not when they have only one or two trapped pieces. Even if their next move doesn’t change the game’s course, you should still allow them to move and not resort to a stalemate where there is no clear winner.
Observe your opponent. If you find yourself in the winning position, be aware of all of your opponent's options. Can they make another legal move without placing themselves in check? Try to envision their next possible moves to see how and when you can deliver a final check.
Give your opponent room to move. One of the most common stalemate scenarios is the corner stalemate. In this situation, a king is locked into a corner by a queen or other piece two rows away and cannot make any legal moves. Leaving at least two possible spaces for them to make legal moves will allow you time to bring in your second piece for check and prevent a stalemate.
Avoid focusing on other pieces. New chess players may find themselves in a winning position and expend time and energy picking off their opponent's less powerful pieces, like a pawn or rook. You can rob yourself of a swift and decisive checkmate and even force your opponent into an insufficient material situation where stalemate is the only option, which will prevent you from winning.

One of the most famous and unique examples of a stalemate took place during the fifth game of the 1978 World Chess Championship between grandmasters Viktor Korchnoi and Anatoly Karpov. The stalemate occurred on the 124th move with a bishop endgame. Korchnoi’s white bishop was unable to attack or defend, and his white king couldn't force his opponent's king into a position for the win, which resulted in a stalemate. The game was the longest in a World Chess Championship final match and the only one to end in a draw before 2007.

When he is trapped on one row along a side, walk the king up to deliver checkmate.
Nice tip!
When he is trapped on one row along a side, walk the king up to deliver checkmate.
Nice tip!
Some people would say that the method shown is inferior and thus not good. If you see a forced mate than don't worry about such "not good" comments until breaking maybe 1400. The first goal is to find a sure win. Making it elegant is a nice, but not necessary, bonus.
I always have a stalemate draw when I have a queen and king and I am playing agaist against Sven Bot.

How can I avoid it?