From a chemists' point of view, designing a good medicine is difficult because you need to design a drug that binds to and activates/inactivates one single type of target in a cell without binding to and affecting any of the other millions of molecules in the body (not to mention, making the molecule stable [but not too stable], able to cross biological barriers, easily synthesized, etc).
A good example here are antihistamines used as allergy medications. Allergies occur when allergens trigger histamine release by the immune system. Histamine is a small molecule that is detected by sensors on the surface of the celll called histamine receptors. When histamine binds to the histamine receptors, the histamine receptors tell the cell to trigger an immune response leading to the characteristic symptoms of runny nose, itchy eyes, etc.
Therefore, if we want to design an allergy medicine to prevent the symptoms of an allergy, we could try to develop antihistamines, molecules that inhibit histamine receptors, for example, by preventing histamine from binding to the receptor. The problem here, however, is that there are histamine receptors in cells throughout the body and these receptors are involved in many other functions. For example, histamine acts as a neurotransmitter in the brain and a class of histamine receptors in the brain help to regulate sleep and wakefulness. As these histamine receptors also bind to histamine, they are structurally very similar to the histamine receptors that regulate immune responses. Many of the features that would allow a drug to bind and inhibit one class of histamine receptor would be present in the other class. Thus, many early antihistamines could not distinguish between these two classes of histamine receptors and would inhibit both those that regulate immune responses and those that regulate wakefulness. Therefore, a side effect of many early allergy medications was drowsiness.
Luckily, there are very subtle differences in the structures of the two classes of histamine receptors. Chemists were later able to develop new antihistamines that bind to only the histamine receptors that regulate allergic responses and not those that regulate sleep. These new antihistamines allowed for the creation of non-drowsy allergy medicines.
The case is even worse for drugs like cancer drugs. Many cancer drugs target enzymes required for cancer growth. However, identical enzymes (not just similar enzymes) are present in other tissues, for example bone marrow and hair follicles, and are also targeted by the anti-cancer drugs. Avoiding side effects with these types of drugs would require finding drug targets present only in cancer cells but not in normal cells, a task which has proven extremely difficult in most cases.