# Are the possible number of waves between an EM wave of 501 nm and 502 nm defined by Planck constant?

To prevent an ultraviolet catastrophe in a black body radiator Planck derived the Planck constant with value $h= 6.6 \times 10^{-34} \:\rm J/s$. But does this also relate to a minimum difference of energy/frequency between two waves? For example can h be used to calculate how many (maximum) waves are there between 501 nm and 502 nm. Or has it nothing to do with each other?

No, that's not what Planck's formalism does. The Planck constant determines the minimum excitation energy that each individual mode can have, as proportional via $h$ to the mode's frequency. This quantization says nothing about how many modes you can have between any two given wavelengths, and in the proper continuum limit you will have an infinite number of modes between any finite $\lambda_1$ and $\lambda_2$.