Consider first the wave model. To detect the frequency (energy) of the wave, you must sit at one location for a finite period of time. You measure the passing of peaks and troughs in the electromagnetic spectrum. You may determine that the peaks and troughs are perfectly regular to infinite repeatability. In this case, you are viewing one or more monochromatic waves having identically only one specific frequency. You may instead determine that the peaks and troughs have uncharacteristic irregularities. In this case, you are viewing a (Fourier) combination of more than one wave, each with a different frequency.
In the monochromatic case, you should need to sit only for at least the time needed for one full wave length to pass by you. In the polychromatic case, you should in principle sit for an infinite time to assure that you have captured all possible (infinite number of) wavelengths. Since you cannot know in advance which case you face, you might guess that you are sitting for some time and that you will need to report an uncertainty in your final result for frequencies and wavelength(s) based on how long you sat and measured the peaks and troughs of the passing electromagnetic wave.
One analogy is playing an FM radio (rather than an AM radio). How long the radio samples the incoming wave and how many samples it takes per increment in time before reporting the tune of a violin A string or a piano C key will mark the fidelity of the final report.
White light is a collection of many (lots of) waves, each with different frequencies. A prism acts to refract each frequency wave in a specific directions. Refraction slows down the speed of a wave, changing its wavelength but not its frequency. This happens inside the material. Refraction also changes the direction that an incident wave travels. This happens at the interface between the material and its surroundings. Refraction occurs because a material interacts with a given frequency of an electromagnetic wave in a specifically different way. Electrons in orbitals are "sloshed around", as are free electrons in a "plasmon sea". Ions are vibrated more, as are polar molecular dipoles. Each mode interacts with various frequencies in different ways, changing the angle of travel crossing through the interface and slowing down the travel through the material.
The photon model is rather more complex to consider for the case you are presenting. Suffice to say that a photon is a spatial localization (a packet) of a combination of waves with infinitesimally close frequencies. The spatial extent of the wave packet is defined by the range of frequencies it includes. In perfect principle, a wave packet with only one frequency (a perfectly monochromatic light wave) would extend over infinite space. Correspondingly, a wave packet with infinite frequencies would occupy essentially zero spatial extent. Actual photons are somewhere between in practice.