Whether a piece of meat is near its shelf life or not, does it also determine how long it can be stored after it is cooked? For example, to buy two pieces of meat in supermarket. They are well sealed and can be kept for a few days; one piece is new, another piece will be expired just next day.

Generally speaking cooked meat can be stored in fridge in a few days. So can these two pieces of meat be stored in the fridge for the same long time after they are cooked?
Food safety rules are simplified to the point where you apply them without any further considerations, edge cases, additional calculations, or anything else. You just do what it says. 

So, when the rule is that cooked meat holds 3-5 days in the fridge, then this always holds for meat which was safe when it was cooked. It doesn't matter if it was cut fresh from the cow or on its last day of safety. The date on the package is calculated such that it will still hold for 3-5 days if cooked on the last day.