Yes. This used to happen in the early solar system, and the leading explanation of the formation of our Moon is that it was the result of the collision of a Mars sized planet called Theia with the early Earth, similar in size to Venus back then.
It could also happen in the very distant future. There’s a possible resonance between Mercury and Jupiter. They aren’t in this resonance at present. But it could happen billions of years inot the future. If so, Mercury’s orbit would get more and more elongated until eventually it crosses the orbit of Venus. There’s about a 1 % chance of that happening. If that happens then Mercury could end up hitting the sun, or ejected from the solar system, but there’s also a very tiny chance it could hit Venus, Earth or Mars.
So we are talking here about a tiny fraction of a 1% chance of our smallest planet Mercury hitting another planet some time billions of years into the future.
This is far far into the future and the Sun by then has already heated up to the extent that Earth is uninhabitable (unless we find a way to shade it of course or move the Sun).
But this is so far into the future that we could have evolved a second time from the smallest microscopic multicellular creatures - not just once, but many times over.
Right now our solar system is stable, there are no extra planets in the inner solar system out to Neptune. There may be planets way beyond Neptune but they can’t come into the inner solar system (an orbit that crosses the paths of Neptune and Uranus, never mind Saturn and Jupiter just can’t be stable long term, so no planet can be in such an orbit - not now, billions of years after the formation of the solar system). When astronomers hypothesize planets beyond neptune they are always planets that remain in orbits way beyond Neptune for the entire orbit. In theory there could be an extra planet that comes inside of Neptunes’ orbit if it has a resonance with Neptune. Pluto does this but none of the other hypothesized Planet Xs have done this to date AFAIK.
So - though possible, it’s not something to lose sleep over. We may well see it in other star systems though.