Related to the OP’s hypothetical, if we did cross paths with Andromeda, for how long would that intersection last? Or to put it another way, how long could Earth be within both galaxies, assuming a hypothetical perfect aim?
The approach speed is 1 ly per thousand years, so in the neighborhood of 50 - 100 million years.
If we as a species survive to witness the event, I'm sure astronomers will still be arguing about where the boundary of a galaxy lies.
One potential outcome would be that the galaxies merge, but by the time the collision is well underway our sun will have aged to a point where Earth will already be quite crispy.