With indexed shifting, you need to keep the same lateral spacing
between cogs. In other words, you need to keep a 9-speed cassette. Sheldon Brown explains towards the end of this page
what is the spacing between each cog. So if you insist on having less cogs with the 9-speed shifters you have, you will probably have to use a few spacers (or useless worn out cogs) for the first two or three "gears". You could also mount your custom cassette on a narrower wheel which has a 7-speed freehub body. In other words, instead of having (for example):
11-13-15-17-20-23-26-30-34, you could have
xx- xx-xx- xx-14-17-21-25-34, where XX is either an old cog or a spacer.
Spacers are essential to make the new custom cassette as wide as the original one. This is necessary so the smallest cog and lockring end up in the proper position. And of course, you'll need to readjust the derailleur limit screws so the derailleur shifts between the newer bounds.
Things you can't do:
1. Just install 5 cogs and spacers, but no spacers "inside": the cassette won't be wide enough, therefore the lock ring won't lock anything.
2. Install wider spacers between cogs: indexed shifting won't work. You could do that – to a point – with friction shifting, but I don't know if your shifters even work in friction mode.
As for the other part of the question: can you shift through wider gaps? Yes. In theory, cogs on mountain cassettes (ex.: 11-34 cassettes) have ramps designed to jump through wider gaps. It may make a difference if you plan to shift while standing, for instance; however if you shift the old fashioned way, without putting too much pressure on the pedals (it's better for the drivetrain anyway), you probably won't have any problems. Just for example, I have a homemade cassette with: 12-14-15-16-17-19-21-25-34, and the 25 to 34 gap has never caused me any problems (except for the change of pace, obviously).