Firstly, by definition of "friend", your friends aren't going to be upset by this. Not by you delaying your studies, and also not by you over-simplifying the details. It's just about plausible that some fairly petty people, who you temporarily think are your friends, would be put off by it, and this would be the way you find out what they're really like. But them's the breaks: you'd find out sooner or later anyway. I recommend just assume your friends will be friendly unless there's a strong reason not to be, and this is not a reason.
Secondly, your statement "I am a third-semester student" I guess isn't entirely accurate in every context, since it could be interpeted as a technical statement about your academic standing. Specifically it suggests you've already passed two semesters and are working on the third, when in fact you've passed one and are working on the second (apologies if I'm wrong on the details there -- my degree wasn't in the US and didn't use the same system). Not that many people deeply care how many course credits you have, but it's more likely to lead to confusion, when people make assumptions what courses you've done or can do next. So it might be sensible not to use those exact words.
Then again, if they asked how long you've been studying because they want to know, as a friend, how much of your time you have put into this so far, then "this is my third semester studying" is a truthful answer and it tells them what they were interested in knowing. Or, if they want to know, as a friend, when it was you first started university studies, then "I started two years ago" is a truthful answer in that context. Possibly they want to know all of these things, and are assuming that they're all the same thing because that's true for most people they know. Well, you're a very slightly atypical case, so there's no way to truthfully tell them a number: "my academic standing, and my time spent studying, and the time since I started studying, are all this number". If they're assuming that, they've made a little mistake, haven't they?
If I ask a simple question with no simple answer, and get back an approximate answer for the sake of avoiding a massive info dump, well, normally I'm going to thank you for not occupying my time rather than "call you out" for anything! But, unless this is all so painful that you want to completely hide it away for the time being, I suggest don't try to give that simple answer that fits into the "rules" they expect. One or two sentences is not too much to answer a question that expects a single number, but there is no single number.
If you are called out by someone you've already told, "I am a third-semester student", then I would suggest either go into the shallow details or else plead privacy and walk away. Likely it's better for you to choose the former. If someone cares that much about the details, you may as well take the time to spell it out. So maybe: "I started two years ago, I spent one semester on X; the next semester was a washout for reasons I don't want to go in to; then I spent a semester attending classes as a guest; and now I'm on program Y, in my second semester as a full student". If they're hostile and trying to trip you up or make you give them private detail you don't want to share, you might choose to give up on them and keep quiet, but that's a pretty extreme scenario.
Even if they're sympathetic, you don't have to go beyond the shallow details if you don't want to. It's none of their business really how it came to be decided you should guest for a semester. However, people are always curious, especially about those doing "the same thing" as they are (studying) but with minor differences from their experience (semester out, semester as a guest). So, if you're comfortable talking about it at all then maybe that's a fair second or third conversation, rather than the introductory "hey, my name's Dude" conversation.
For future introductions, and maybe to "correct" any misunderstandings with the people you've already talked to, focus on summarising the information that's actually important. If someone asks how long you've been studying, then they might be interested in all sorts of things about you. So, OK, it's a tiny bit complicated, but they're not actually asking why there was a gap in your study, so you don't need to get into your life story at all. You could say, "I started study in 2017, but I had a gap so I'm currently second-semester". If you really don't want to talk about the gap at all (or you want to justify saying "third" in the past and "second" now), you might want to gloss over the gap: "I've switched programs, and because of that I attended some classes that didn't count, so I'm officially second semester".
Oh yes, and although I've given example phrases, don't learn an exact formula what to say, because people will end up asking different versions of the question, or talking about other stuff where the same information is relvant, but your formula won't always fit and you sound like a politician trying to dodge a question. Decide what you want people to know. Think of at least one way to say that, so you're clear what you're going to focus on. Then don't mention the rest of it.