Sherlock Holmes did not use opium. Watson once described him as appearing as someone under the influence of opium, but discarded the suggestion. In another story ( The Man with the Twisted Lip ) Watson discovers Holmes in an Opium den, but Holmes is on a case and in disguised.
The cocaine habit is probably exaggerated. Watson does not give a frequency of his usage and reports Holmes as saying that he only uses it when he doesn't have a case to occupy his mind. Whether this means he uses it a few times a week or a few times a year is not stated.