In regards to the 3D Mario titles, Sunshine is my favorite, followed by 3D World and then 64.
Yes, 3D World was linear, which I dislike, but each level was pretty creative, and the game certainly had challenge towards the end. As for 64, despite having played it when I was younger, and being amazed at seeing Mario in 3D for the first time, I'm not nostalgia blind for the game. Even back then, I remember eventually getting bored with the game because of how bland it was. When comparing 64 to 3D World, despite liking the gameplay of 64 more, 3D World is an excellent example of design trumping functionality. The game never once felt stale or boring, even in similar looking levels, there was always something new.
Sunshine is a blend of the two, I love the gameplay, and though it has a repeating tropical island theme, each area has it's own bit of charm, and the level designs themselves are top notch. It all adds together to form a pleasing experience for me.
I'd argue the soundtrack bit as well, though Galaxy has some amazing orchestral themes, 3D World has jazz. Instant trump.