Buying an illegal substance online and having it ship to you isn't dangerous when you know how to handle it.
People have been doing it forever and there should be enough online to keep yourself safe. Even when law enforcement knows the package you ordered contains illegal substance by the package being intercepted. You first order with using encryption to keep your delivery address private and only visible to the seller. You never go pickup the package. Basically, you succeed if its left at your door or mailbox and only bring it in to your place. Once you have the package you literally wait a few days to a week and without opening it; just have it sit in a pile of junk mail or wherever.
The worst case is if the police were to want to arrest you. Usually they don't care about the buyer and only the seller. If they wanted to arrest you, they'll go to your home with a warrant and hoping to see the package open. Since it's not open from waiting a few days, you deny knowing what the package contains or who it's from and say you were going to toss it with the junk mail but haven't gotten around to it because garbage day is whenever. You then proceed to say you want to speak to a lawyer about this all because you're nervous and are going to decline answering questions until then. They may hold you in a room with saying they know what you've done and try having you confess. You just keep quiet with saying you're waiting for your right to speak to a lawyer first. Eventually you should be out of the rare possibility that people should be prepared for in all cases.