Of course, if we define moderate use of a substance as the level of consumption where health effects are little to none, you can consume something without jeopardizing your health.
You seem to be implying that either heroin or cocaine cannot be consumed in moderation (which is false[0][1]), or that their moderate consumption is tremendously bad for your health. If it's the latter, prescription opioids and stimulants like methylphenidate can be taken in moderation with limited health effects.
Many prescription opioids are very chemically similar to heroin. All prescription opioids work primarily via the same mechanism as heroin. Heroin is used in a medical context under the name diamorphine.
[0] http://jod.sagepub.com/content/13/2/219.abstract [1] http://www.doctordeluca.com/Library/AbstinenceHR/ControlledH...