True, but the way in which they affect each other is that they try their best to collide.
From that perspective, it's kind of weird if collisions don't happen.
Interestingly enough, when galaxies collide, the supermassive black holes at their centres do typically merge as their gravity is strong enough to attract each other.
It's by the way not particularly unlikely for stars to pass through other solar systems. Apparently about 70 000 years ago a binary star system flew through the Oort Cloud.
That’s hand wavy because if you’re imagining like grabbing the two galaxies and smashing them together… that’s like giga levels of magnitude faster dynamics than the speed of light, ha!
You’d have to like put the galaxies on top of each other and leave them there, probably for years, for gravity to get everything moving quickly enough (and then for the speed of light to even bridge the distance!) before really anything would happen. I think.
Engineer but not a physicist.
So with two galaxies colliding I would not expect the stars to hit each other as result of collision. But as result of interactions when speeds increase.