Computers like life are unpredictable !
First of all sorry for my bad english, Buying an iMac, Will it run without any problems for 4-5 years? How long will an iMac last?. Will programs and apps run on iMac after 4-5 years? .
Your use of English if lots better than some on the forum who profess to have it mastered along with superior knowledge of the Apple world.
Come on now, your questions of things lasting without any problems, will programs keep running, or should you buy a different model. All that kind of thinking is not in line with the society we live in. Everything is designed as a throw-away-product. Even things that are supposed to last a life time, like a new knee joint can fail.
It might help if you take excellent care of it, but there are things in a computer or any electronic product that just die. Die when they are brand new, or a week after you boot them up. Thats why warranty sales are in order, but Apple only wants to put your worry to ease for 3 years. I am not sure if extended warranties are offered or not.
Good luck or bad luck is mostly a crap shoot, hope for the best and dont be surprised if what ever computer you buy goes out now and then, it keeps repairs in order.
Just my take, the times I have not purchased an extended warranty, the darn stuff goes bad, when I buy extended warranty, it is never needed until about a week after it expires. Such is life, very unpredictable to say the least.