To understand this, unfortunately, requires a bit more of a background in the grammatical conventions of ancient Greek, and the cultural conventions of Jewish genealogies.
First a note on context. The opening chapter of the book of Matthew is written from the perspective of Joseph, with Mary only being mentioned as Joseph’s wife. In Luke, on the other hand, the story is told from the perspective of Mary. This is our first indication that the genealogies are for different people.
Why isn’t Mary listed in the genealogy given in Luke? The answer lies in understanding the strict Hebrew tradition of only mentioning males in genealogies. Instead, Luke uses language that identifies Jesus directly through His maternal grandfather, Heli.
The original Greek text of Luke 3:23 is written: Kai autos en Iesous archomenos hosei eton triakonta, on huios, hos enomizeto Ioseph tou Eli
Often, such as in your translation above, this is translated in english as “And Jesus himself began to be about thirty years of age, being (as was supposed) the son of Joseph, which was the son of Heli” We have clues in the original Greek that this might not be the most clear way to translate what section belongs parentheses. Joseph, unlike any of the other names in this genealogy (and unlike any of the names in the genealogy given in Matthew – including when Joseph himself is listed) is not proceeded with the article tou (Greek for the). This, in context, sets him outside the genealogical listing that follows and places him into a peculiar intermediary position. Another way to translate this verse, perhaps matching better with the intended structure, would be “Jesus, when he began his ministry, was about thirty years of age, being the son (as was supposed of Joseph), of Heli”.
This is merely to indicate that Jesus is the descendent of Heli, supposedly through Joseph. The connection through Joseph is only “supposed” because Joseph is not, of course, Jesus’ biological father.
The seemingly direct connection that that remains between Heli and Jesus is not problematic either when you consider that the purpose of Hebrew genealogies is merely to show the connections between ancestors, and that skipping individual links was common. You can see this in the Matthew genealogy that you cited yourself, where Ahaziah, Joash, and Amaziah are left out from verse 8 when they form the actual link between Joram and Uzziah. (See also Ezra 7:3 vs. 1 Chron 6:7–11.)
Clear? Probably not, I’ll bet. Let me know what is still confusing and I’ll try to clarify if you’d like. Just remember that the purpose of genealogies was never to meet the standards of a court of law, but merely to show the connection between the ancestor (in this case Abraham) and the descendent (in this case, Jesus).