I found these words from my New Testament colleague when I taught at Southern Seminary to be helpful and clarifying:
What is the distinction? We can define preaching as the invitational and exhortational proclamation of biblical and theological truth. Teaching, by contrast, is the explanation and explication of biblical and theological truth.
What is shared between Christian preaching and teaching is the content—biblical and theological truth. The difference lies in the mode and immediate goal. Preaching is biblical and theological content selected and presented in a mode of proclamation with the immediate goal of invitation and exhortation. Teaching is biblical and theological content presented in a more detailed and systematic way for the purpose of explaining and unpacking complex issues, their interconnectedness, and their implications. There is overlap, but there is also distinction.
. . . We can also approach the preaching-teaching distinction from another angle: Preaching is monological, while teaching is dialogical. Preaching is communication that moves in only one direction, from the preacher in the pulpit to the hearers in the pews. . . . Teaching, on the other hand, if done well, is dialogical by nature. The communication of content is driven by the teacher, but questions from the hearers shape the conversation and interchange that happens in the classroom. Good teaching is inherently dialogical.
Jonathan T. Pennington, Small Preaching: 25 Little Things You Can Do Now to Make You a Better Preacher (p. 30, 31). Lexham Press. Kindle Edition.