Standard 7 speed is 5.0mm spacing.
Standard 5 speed is 5.3mm spacing.
They aren't comparable, but it's close enough to "work". However, you will only be seated on 1 gear correctly, and all the others will grind. That will eventually lead to sprocket and chain failure, and isn't so healthy for the derailleur either.
Nothing else used 5.3mm spacing. for 5, 6, and 7 speeds, the derailleur is often the same, as the chain width is the same. the difference is in the shifter. A 5 speed uses different spacing between it's index points, moving the cable a bit more.
If you have no other options, you could try setting up the 5 speed sprocket and 7 speed shifter doing all your tuning and spacing adjustments using 3rd gear. With 3rd gear being perfectly centered, that would mean 2nd and 4th were only .3mm off, and might not make much noise. 1st and 5th would be .6mm off and would make more noise but maybe not much if you keep the chain well greased. This would be functional for a short time, maybe long enough if you never shift out of 3rd. But it will eventuality fail, And this is the kind of failure that only breaks when stressed, like when you are pedaling hard to get away from some angry dog, angry swarm of bees, or angry husband who just caught you with his lovely wife.
Here's the chart of spacings:
https://www.sheldonbrown.com/gloss_sp-ss.html#spacingk7
And now the sauce, this is the first google hit I found for a 5 speed shifter:
https://www.ebay.com/p/691209372?iid=302916374297