I have figured out two options:
The less elegant option is just putting some washers on the end of your axle, such that they lie between your locknut and the dropout when the wheel is installed. You have to fiddle with the washers every time you take off your wheel, but they will do the job.
If you want to avoid that, you have to put them inside the locknut. If your wheel is such that the bottom of the locknut is outside of your cassette or freewheel - i.e. above your lockring, if you have a cassette - you can just put a washer between your locknut and cone. If the bottom of the locknut is not exposed, you may be able to still put in a washer, but it may block the splined locknut/freewheel remover.
In that case, you have to use a part that is specially made for the task, usually called "axle spacers". You can find them on the internet by searching for "bicycle axle spacers", and they come in a bunch of sizes down to 0.5mm, so you should be able to find the perfect combination for your setup. You can put these between your locknut and your cone, and they will leave room for inserting the splined freewheel/lockring remover.