Just like any cooling system, they are highly dependent on the heat exchangers being clean. Over the years, they will collect dust, dirt, insects, human hair, etc., that eventually clog the heat exchangers, radiators, condenser coils, or whatever you want to call them.
Unplug the refrigerator. Pull away from wall. Remove rear panels (no special tools required). Once panels are off, you can see the compressor and condenser coils, and all the afore mentioned dust accumulations. Clean everything carefully.
Once done, put it back together, turn it on and allow 24 hours to determine if cooling capacity has returned. It is very useful to have internal thermometers to test your freezer and fridge temps before/after.
Now, if no improvement, then your thermostat could be failing, preventing the compressor from running long enough.
However, before going down a long laundry list, perform the cleaning steps first, then report back for additional support.
This may help too: Repair Tips For Fridge That Not Cooling