Ask a lawyer.
Like if you're writing about travels and adventures it's possible that you first need to check which countries/states laws apply in the first place and if violation of laws in one place are able to be prosecuted in another.
Also with regards to drugs, there are countries where everything about them is illegal while in others the consumption is decriminalized to not prevent people from seeking help for their addiction, while everything relating to making it available (sales, giving up, etc.) is illegal. So is there a crime and what is the crime.
Then there can be statues of limitation, so things that are so far in the past that they are no longer legally relevant even if you admit them. Though there could also be a difference between penal and civil lawsuits regarding that. So idk you might no longer be charged for theft but would need to give back the object that you've stolen or stuff like that.
Also is that incriminating evidence or could you later deny that and law enforcement couldn't prove it even with that knowledge.
Is it a crime that triggers default investigations or is it a crime where only the person effected can trigger the investigation.
Anonymization of partners-in-crime. Who might otherwise sue or have to sue for defamation to save their reputation, which they likely could do even if the actual deed is far in the past.
Are you popular enough so that media and fans or the police are going on the hunt to uncover evidence or is it a tidbit of information that isn't further able to be investigated.
Is it an autobiography or just autobiographical. So are you writing about yourself or just let your character go through the events of your life but having a distance between them and you.
Like what layer of plausible deniability do you have between, putting a legally binding oath of accuracy in the intro to writing about a friend that everyone knows is actually you.
Also might want to check if it gets you in trouble if you claim a factual crime the police investigates and finds nothing, so whether you could be charged with inventing a crime and wasting their time or worse incriminate someone else.
Like some of these things you could check for yourself, in some cases the risk is quite small anyway and you'd get at most a monetary fine. While if you want to be on the safe side, ask a lawyer what could hypothetically happen in those cases.