As a non-native English speaker whose mother tongue has not distinct pronouns to address male/female third persons, it is trying to avoid confusing he/she in speaking. I wonder how would native speakers deal with this case?
Is it also happenning in vernacular English?
Isn’t it offensive (or pejorative) to use he for a female or vice versa?
Native speakers do not usually confuse “he” and “she” (that is, they don’t use one in place of the other). When talking about people, the distinction is made consistently and obligatorily in all registers of the language, both formal and vernacular. There may be some dialects that have different usage, but if so, they are not well-known to the speakers of the most widely spoken dialects.
Native speaker do occasionally use “he” to refer to a female person or “she” to refer to a male person as a form of sexist insult (to imply that the female person is unwomanly or that the male person is unmanly), but that usage is pretty uncommon even in pejorative contexts. For a non-native speaker, I don’t think it’s necessary to worry much about causing offense by accidentally using the wrong pronoun: unless it seems obviously intentional, people probably won’t interpret it as an insult.
Using the wrong pronoun is more likely to cause confusion. For example, if you say something like “When I saw my brother the other day, she told me the news”, your listener will probably be unsure whether you are talking about a brother, a sister, or two different people. Listeners who have experience talking to people who speak languages without gendered pronouns might realize what you meant, but still notice the misuse of the pronoun, as mentioned in william.berg’s answer.
A separate issue that people might mention in connection to your question. Some dialects or vernacular ways of speaking may use “he” or “she” in place of “it”. However, that kind of variation occurs when talking about objects, not when talking about people.