(For reference: I am a cyclist. I train with professionals, although I don't plan on becoming a pro myself, and I'm currently finishing up getting my cycling coaching license.)
Yes, adjusting your derailleur with the bike upside-down is fine. This will allow you to pedal while adjusting, which is kinda necessary to get a more-or-less accurate adjustment.
However, you should be aware that in the event that you have hydraulic brakes, leaving your bike upside down even for ten minutes will result in your brakes being temporarily useless for a minute - so don't immediately start riding a technical downhill trail after adjusting it upside down; wait a few minutes for your brakes to go back to normal after flipping it the right way up again.
(I once got my bike out from underneath a bus and immediately hopped on and starting pedaling, to make a connection five minutes away, and very nearly crashed due to the brakes not working yet.)
If you have hydraulic brakes, then make sure you aren't storing your bike upside down for extended periods of time either. If you're at home adjusting your shifting system, and it turns out you need to get a part, don't just leave your bike upside down for days - you can ruin your brakes that way. A few minutes or even a day upside down won't ruin your brakes, but leaving it for longer can leave you needing to replace the oil or other parts.
If you don't have hydraulic brakes, then you should be fine. Just note that you can scratch up your handlebars if you put it down on rough ground (yes, again I speak from experience).