How can I switch 2 yellow corners that are on the same face from a 3x3 cube?

How can I switch there two corners?

Is everything else on the cube solved? Because if it is, this isn't solvable. Swapping just two pieces (applies to both corners and edges) on a regular 3x3x3 Cube isn't possible. It is possible to have a double 2-swap, or a 3-cycle, but just a single swap not. You or someone else most likely accidentally or on purpose popped pieces, and put it back together incorrectly.

Here some more information I posted before in a relevant question. Some relevant quotes from that post:

Let's start with the 3x3x3 Cube. The only moves available are face turns and slice turns. However, slice turns like M, can be deducted into two face turns RL'. Because of that, we can say the only available moves on a 3x3x3 Cube are face-turns.

So what does a face-turn do?

• It 4-cycles four edges;
• It 4-cycles four corners;
• And it orients the center by 90 degrees.

You can't do one, without the other.

When we look at how we solve twisty puzzles, we always have to have an Even State to solve them. So when we swap a set of two corners, and a set of two edges, it means we do two swaps, which is even. When we look at the 4-cycles of a face-turn, we can say we need three corner swaps AND three edge swaps to accomplish the two 4-cycles. Odd + Odd = Even, so a face-turn is an Even turn. A 3x3x3 Cube is in an Even State when it's solved (zero swaps left). So since we started with Even, no amount of turns will change that. Even + Even = Even, and therefore a regular 3x3x3 Cube is always solvable.

If you indeed only have two corner pieces left to swap, we start with an Odd State, and solving it is an Even State.
But, Odd + Even = Odd, and this will always remain Odd, and therefore it will remain unsolvable no matter how many turns you make.

If you still have other pieces left to solve, please make a picture of those unsolved pieces as well, then I or someone else can guide you further towards a solution. Swapping just two corner pieces on a regular 3x3x3 Cube isn't possible, though. So you'll have to carefully pop and put them back together correctly to solve your 3x3x3 Cube in this case.