Generally, the customs service and/or border police attempt to apprehend contraband at the point of entry. Once it has entered the country, it is typically up to domestic law enforcement such as the police to locate the criminal. I believe in some places there is a special "financial police" that also handles crimes such as tax evasion which may be involved.
Fentanyl is a controlled substance so that particular example would probably fall under the purview of a specialized drug agency. Customs still attempts to check incoming goods, and if any of them aren't lawful, they detain them. But this is a somewhat passive approach. The drug agency will actively track down incoming shipments and try to intercept them based on prior knowledge.
It is typically more a concern of the recipient country, because many countries have a great interest in keeping things out. Thus they devote substantial resources towards it. With contraband such as drugs, countries have slightly less of an interest in preventing it from leaving. After all, if it leaves, it becomes someone else's problem. Right?
Not really. Consistent poor control of exports can damage international relations. It can also support domestic criminals who gain income from the export. It creates crime in the originator country and corruption in the border service. For this reason, exports are less controlled only in the sense that they have second priority to imports - otherwise they are very important.
Also certain specific classes of goods, such as historical artifacts, rare animals or their parts, currency, valuable stolen items, are obviously very important to prevent from leaving. For these, the authorities will tightly control the exports.
I think that in many cases where drugs (or any contraband really) go from country A to country B it is not an accident they go from country A. It is probably because country A is where it's easiest to produce them in bulk. Countries that generally have poor rule of law would be the top candidates. Whereas country B is one with a market for it, so one with wealthy people. Wealthy countries tend to have strong rule of law. So you have a trend where originator countries are usually much less orderly than recipients to begin with. Maybe this creates the impression that originators do not do as much, or do not have as much responsibility, if they do not do more to stop the flow of contraband. Rather, it's the other way around.