In both Matthew 1:25 (ἐγίνωσκεν) and Luke 1:34 (γινώσκω) the same base verb, γινώσκω, is used though in different forms.
The meaning of the verb is properly, to know, especially through personal experience (first-hand acquaintance).
When read in context the meaning is clear.
Mary's question to Gabriel is how is she going to have the baby when she knows she and Joseph haven't engaged in sexual intimacy.
That can be the only meaning of her question.
Does she know Joseph? Yes. Have they met before? Yes. So it isn't referring to an acquaintance meaning. This leaves only the sexual meaning of the term.
Gabriel explains to her how this will happen in 1:35.
Likewise Joseph, did not "know" Mary until after Jesus was born.
Same questions about Joseph. He knew Mary, they had met, talked, etc. So this only leaves the sexual meaning of the term.
In modern day English we use similar terms for sex. Have you intimate knowledge of him/her?
Again, understanding the Greek and the context of the passages and subsequent ones where Jesus' family is noted can only lead to one understanding.
Joseph and Mary, after Jesus was born, consummated their marriage as any normal married couple would. There is no contradiction of the requirement Jesus be born of a virgin. There was no requirement of Mary remaining a virgin.
The fact “know” refers to sexual relations in both Greek and English is not being disputed. The point is that Joseph and Mary were already married at this point and they still didn’t “know” each other sexually; and her expression of surprise at the angel’s announcement that she would become pregnant doesn’t make sense if she and Joseph were planning on “knowing” each other sexually in the future. Were they planning this, she would have instead interpreted Gabriel’s message as meaning she would become pregnant by Joseph the normal way, rather than asking, “How shall this be, seeing I know not a man?”