During Phase 2, participants with RET rearranged NSCLC or thyroid cancer will be given the maximum tolerated dose. During both Phase 1 and Phase 2, the investigators will determine the effect alectinib has on the body, and the effect alectinib has on cancer.