Zanzibar usually works best after safari, not before. The most common route is to visit Tanzania's mainland parks first, then fly to the island for beach time, Stone Town and a slower finish.
Most travellers add Zanzibar after a mainland safari because it gives the trip a natural rhythm: wildlife first, beach second. After early starts and long game drives, the island gives space to rest before flying home.
Zanzibar can be connected with northern parks such as Serengeti, Ngorongoro and Tarangire, or with southern parks such as Nyerere and Mikumi. The main planning decision is how many beach nights to add and which part of the island fits your travel style.