If you smoke, quitting is the number one thing you can do to improve your physical and mental health. In the US you can call 1-800-QUIT-NOW or visit Lung.org for free evidence-based resources to help with quitting.
On to the OP question, inhaling smoke of any kind exposes you to carcinogens. In tobacco smoke, the most abundant by mass is Benzo[a]pyrene, which is created by the process of burning. It is absorbed into your bloodstream in the lungs and damages DNA in every cell it touches. If the DNA damage occurs in the wrong gene, that can kick off a decades long process of more mutations that ultimately lead to uncontrolled cell grow. Inflammation, also caused by inhaling smoke, encourages cells to grow more and amplifies cancerous mutations.
Quitting stops the exposure to new DNA damage and inflammation, but there has already been some damage done.
HumanPerson@sh.itjust.works 2 hours ago
The effect is cumulative, you’ll do better if you quit than if you don’t, but some damage has been done. It’s a “the best time to plant a tree was 30 years ago, the second best time is today” situation.