I have read that "it (e.g. a situation) got me confused" is not correct. But in some books I have read sentences such as "you got him confused by...", so is it wrong, too? Or neither is?
it got me confused
(where "it" is a situation) is a completely correct construct. One of the meanings of "get" is to cause something to happen.
He got me ready
It got me fired
He got the computer working
Some would see it as relatively informal, but it is frequently used. You will read it in many places, including well-known and highly-crafted works. "It made me confused" would be an alternative.
you got him confused by...
is exactly the same construct with exactly the same usage. Each is as acceptable as the other.
Note the slightly different construct
you got him confused with someone
meaning that you mixed up "him" with "someone".
it got me confused.
The usage shown in your example is illustrated in Cambridge Dictionary
get in this context is defined as cause as in "to cause something to happen, or cause someone or something to do something".
[ + adj ] She had to get the kids ready for school.
Erm, just don’t use that form, it appears fairly badly formed to me, much better:
You confused him.
The instructions shouted by the Sargeant Major confused me.
I became confused as to the plot as the story progressed.
Confusion abounds as someone sticks “got” in the sentence!
Alternatives, for other forms:
I mistook her for someone else.