There is a bit of an overlap between witnessing and preaching.
In Scripture, preaching is usually privately or publicly telling or proclaiming to people about the gospel message or some other message from God. For example, Jesus was preaching the word to the people, Mark 2:2.
And many were gathered together, so that there was no more room, not even at the door. And he was preaching the word to them.
In Acts 5:42, the disciples after the resurrection, did not cease from teaching the people that Jesus is the Christ, both in the temple and from house to house.
And every day, in the temple and from house to house, they did not cease teaching and preaching that the Christ is Jesus.
Romans 10:14-17, shows that preaching is the telling of the good news to people. This passage emphasises the necessity of preaching.
How then will they call on him in whom they have not believed? And how are they to believe in him of whom they have never heard? And how are they to hear without someone preaching? And how are they to preach unless they are sent? As it is written, “How beautiful are the feet of those who preach the good news!” But they have not all obeyed the gospel. For Isaiah says, “Lord, who has believed what he has heard from us?” So faith comes from hearing, and hearing through the word of Christ.
Similarly, witnessing can be telling or testifying to people about God’s message. For example, John the baptizer came as a witness to bear witness about the light (Jesus). John 1:6-8.
Peter said (Acts 10:39-43) that they were witnesses to the events that occurred concerning the work, death and resurrection of Jesus and that they had to preach of these things to the people. So we see a slightly different meaning between the two words, in this passage. They were witnesses because they had seen all that Jesus did, and because they were witnesses they had a strong obligation to preach or publicly proclaim to the people about these things.
We see the close association between these two words, in Matthew 10:18-20:
you will be dragged before governors and kings for my sake, to bear witness before them and the Gentiles.
When they deliver you over, do not be anxious how you are to speak or what you are to say, for what you are to say will be given to you in that hour. For it is not you who speak, but the Spirit of your Father speaking through you.
This passage shows that bearing witness in this case, involved speaking the message from God. However, being a witness doesn’t always involve speaking. Israel were (and are) a witness to the existence of God because of the prophecies given by God about them and the graphic fulfilment of these prophecies. So without them saying a word, Israel witnesses to the existence of God.
So preaching usually involves publicly or privately proclaiming the message of God to people, and witnessing can involve speaking forth God’s message or it can involve people or circumstances confirming by various circumstances, God’s existence and or plan.