I'm seriously torn between the two phones
There are few moments to consider, let me start from the least important:
1. Prestige. There are cars (VW, Opel, even Lada), and premium class cars (Audi, Volvo, MB, BMW). Most of the people buy cars, but some value premium brands. A number of first ones is much greater than a number of second ones. In case of Samsung, they always used to have an aggressive marketing - and that brings results. Most people do not check very carefully all the details. But some do. Surprisingly, a price tag of both S5, and Z2 is similar. Great. Because... It's a Sony!
2. Ecosystem. Now it is not about Google one, which is great one, but about companies' ecosystems. Samsung has something like that. But sorry... I never used that and always hated their bloatware. Sony offers a list of useful applications and services, including Play Memories with unlimited storage for pictures and videos, Walkman, Lifelog, and few applications that help you to operate Sony TVs, receivers, media-centers, and other home electronics. And the beauty is - you do not need to install them, and you can always remove them. This is not a case with Samsung phones.
3. Quality. My experience with Sony product is longer than a quarter of century, and with Samsung products is even a bit longer. During this time I have never experienced any problems with Sony products (I own many of them, and often recommend to others), and barely heard someone did. But I have experienced many problems with Samsung products, and continue to hear of those from all around. Almost all Samsung (including S4) phones that our university bought for our staff, had to be fixed within first 0,5-1,5 years. Quality build of Z2 is not only for beauty. A solid contraction that you cannot bend and twist, ensure that you will not have any problems with electronics - those that may be caused by micro-cracks and short-circuits.
4. Technical excellence. 200 extra MHz of the same chip that S5 has cannot compete with extra 1 GB RAM (3 in Z2 versus 2 in S5) that Z2 has (50% more!). An overclocked CPU brings some benefits (not much though, as it is overclocked just about 8,7%), but also is a faster battery withdrawal. Therefore, Z2 is a better bet to the future. Speaking of batteries, Sony is well known of making the quality ones. Those that I use with my Sony video cameras, for example, last longer than obsolescences of those camers (which are longer than 5 years in my case) Speaking of Z2 camera, only Lumia 1020 can compete with Z2 at these days IMHO.