If the drug is a pill, there are online identifier applications where you can enter the medication's imprint, numbers, color, and shape. They are designed to help you figure out which pill you have found.
Although identifying powder is more complicated, there are fentanyl testing strips that you may use to screen for the presence of fentanyl.