The first step to getting well is admitting that one has a problem and is powerless over the drug (and/or substance), and you seem to realize that. A person can be a "functional addict," for instance, which refers to possibly having a full-time job and seeming "okay," but the individual's life is still negatively affected in various ways by the addiction.
Please seek outside professional help for the cocaine use, especially before something catastrophic happens. Those who use cocaine, which is categorized as a stimulant, may be at risk for stroke ("brain attack"), for instance, which is a type of brain injury that may result in partial or one-sided paralysis.
There are different programs for those with addiction issues, which may include an outpatient treatment program for certain individuals. The two credentials to look for in a substance abuse counselor is either a Certified Addiction Counselor (CAC) or a Certified Alcohol & Drug Counselor (CADC).
Another respondent mentioned to consider making other friends, and that may be another step to leading a healthier lifestyle too.
The following website should have some local counseling and treatment programs for those with mental health and/or addiction issues. Some people with a drug and/or alcohol addiction may also have a mental illness. For those with both a mental illness and addiction (or if suspecting a mental illness as well), there may be a program referred to as MICA (mental illness chemical addiction) for those with a "dual diagnosis." There may be an outpatient treatment program for MICA too:
https://findtreatment.samhsa.gov/
Their toll-free 24/7 ** referral ** hotline:
1-800-662-HELP (4357).
Please also consider a 12-step program, such as Alcoholics Anonymous (AA), as a program of recovery, especially in addition to therapy. (Some 12-step meetings may be online these days because of Covid-19 restrictions.) If one doesn't have a drinking problem, he or she may attend an "open" AA meeting. The only requirement is having a desire to be sober.
Here is their website for more general info:
https://www.aa.org
NAMI (national alliance on mental illness) is a non-profit organization that has more general info and resources for those with mental health conditions *and/or* their family members or caregivers, and their website has more general info re: those with substance use disorders too (however, *not* for self-diagnosis or self-treatment):
https://www.nami.org/About-Mental-Illness/Common-with-Mental-Illness/Substance-Use-Disorders
This website has more general info re: those with "addiction" issues (though, also for informational purposes):
https://www.helpguide.org/home-pages/addictions.htm