This might be better answered with a different situation. A distant star emits light in all directions. As part of all this, a photon is emitted. What path is it on?
There is no way to tell while it is in flight. It spreads out in all directions like a wave. It might wind up anywhere.
Eventually it hits your eye. Now you know where it wound up. Can you say it followed a straight path?
You can collect a lot of photons that enter your eye. You can try things out. Put an object between your eye and the star. It blocks all photons. Put it somewhere else. It doesn't block photons from the star. You conclude that photons travels in straight lines and hits a receptor in your eye like a particle.
Try some more. Put a wall between you and the star. Put a hole in it. If the hole is big, you get particle-like results as before. If you shrink the hole, you find that some of the photons miss your eye and hit a receptor in the eye of a person next to you.
Now they are acting a little like a particle and a little like a wave. You know they wound up at the hole, but you can't say where in the hole. You might think that limits any path they took. They don't hit the wall, but continuing that path doesn't predict which eye they hit. You need to use waves to make a prediction of where they might hit. But when they do hit, they only hit one receptor in one eye.
Put two slits in the wall, so that you are between them and neither aligns with the star. Some photons hit you. None hit the person next to you. Some hit the next person over.
Photons don't change back and forth between a particle and a wave. They are kind of like both. See How can a red light photon be different from a blue light photon?. Sometimes a particle following a path is a good approximation to what they do, and sometimes not.
Ray optics treats them like straight line particles. It works very well, but not perfectly. When light from a distant star hits a camera, it passes through a large hole. The lens focuses all rays onto a single receptor. But passing through a hole introduces a tiny uncertainty in which receptor will be hit. This is called diffraction. It is the wave like nature of light limiting how well ray optics works. A perfectly designed and manufactured lens is said to be diffraction limited.
So sometimes light travels in a straight line, sometimes almost in a straight line, and sometimes not much at all like a straight line. You can derive all of these behaviors from wave properties of light. See Explanation of diffraction of a single light ray by Huygens' principle.
This tells you that light has a spread out nature. You have to add up contributions from everywhere that light is to find out where it will be next. If light is widely spread out, like a plane wave from a distant star, the prediction is that it will continue in the same direction.
Then light hits a hole in a wall. Now it fills the hole, but no farther. If you add up just that much, the wave largely continues straight but spreads out. For a small hole, it spreads out a lot.
But this wave is not a classical wave. It doesn't tell you where the light is. It tells you where you might find light if you measure it. This spread out wave can hit a single receptor. It is something like a particle.
Also you should not think of the particle like nature as a classical particle. In particular, it does not have a size. It can fit a hole or a receptor.
The important particle like property is that the energy of light comes in lumps. When a photon hits a receptor, one lump of energy hits. Nearby receptors get no energy. When a photon passes through a hole or double slits, either all the energy passes through, or none.
The wave tells you where the energy is likely to wind up, but not which receptor will be hit.
This is one of the central counter intuitive parts of quantum mechanics. It is so unlike the cause and effect we are used to from classical physics, that we struggle to make sense out of it. The immediate question is "If a spread out wave arrives at a bunch of sensors, what causes it to pick just one?"
The answer is that cause and effect does not work this way. You just have to get used to it. Nothing travels from distant points of the wave to the lucky receptor. Nothing travels from the lucky receptor to other receptors. It just turns out that one receptor is lucky and all the others are not. All cause and effect has to say is the if a photon arrives, it will arrive somewhere. The wave tells you the probability of where.