He played Gandalf in The Lord of the Rings trilogy and Magneto in the X-Men franchise, which also includes appearances in X-Men: First Class alongside a young, albeit brief, appearance by a Star Wars actor, James McAvoy.
Although they are both in the same film, this does not technically count as both actors being in the same franchise as both films have very different storylines and are unrelated.