A person can do what they must to survive, to avert death.. even if that means stealing food when in dire situations. It's even reported that the rightly guided caliph Umar ibn Al Khattab رضي الله عنه said, "do not cut the hand of the thief who steals dates in the year of famine". If there was no leniency, this would not have been his verdict; rather he would've upheld cutting off their hands even in famine.
The concept of doing what is forbidden out of necessity/compulsion is proven through the Qur'an. Allah (ﷻ) made exceptions for those who are driven to eat something haram out of necessity, on the condition that they have no inclination (desire) to do that action otherwise. You can read this IslamQA fatwa for the details and conditions:
Permissibility of haraam things in the case of necessity and the conditions governing that.
Hopefully this answers your question.
It's important not to dwell on "hypotheticals". This situation you describe is very unrealistic. Some people have other options and yet they still pretend they have no options and need to do haram. This is delusional and they are going to get the full extent of sin for those actions.
e.g., if the person has the ability (land, water, etc) to grow something on Allah's (ﷻ) green earth, then it makes no sense (and would be haram, no exceptions) why he would choose an "illicit substance" over something that is pure and halal.. like farming food and selling it for sustenance. Moreover, it's harder for those with bad pasts to get jobs but not impossible. Nowadays some places even offer specific jobs and/or free programs for rehabilitation to such people who are trying to turn their lives around.
And there's a few other options that you're overlooking. This person should first seek out the nearest masjid (mosque) for assistance, financial and otherwise. Masajid do not do background checks to help people :) But if for some reason the masjid cannot help (unlikely), begging on the streets is still better than stealing!
All in all, the person should strive to do what is right from the start, and Allah (ﷻ) will support him.
Qur'an 65:2-3 "whoever fears Allah - He will make for him a way out And will provide for him from where he does not expect"