As another poster said, hardware seems to last longer than people find it useful. I have several old parts sitting around my home that still work great, but aren't needed.
The OS, however, will probably cease to be useful much sooner. Since XP is proprietary, when MS stops their support it will be hard to maintain. Many older machines can't run Windows 7. For me, the answer is a FOSS OS. I have a really old computer (only 128M RAM) that can't handle XP. Instead of throwing it out, I have installed Arch Linux and run it as a server at home. I did add one HDD to hold some files that it is serving and an extra NIC, but all of the old parts still work great.
Even though many parts can last quite a long time, some break that are even new. Always back up your data and expect parts to fail.