What is the meaning of [Better to wear out than to rust out.]

It is better to remain active than to be idle (used mainly for old people)

Example: X: Seeing your age, I wouldn’t recommend you to work so hard. Y: It’s better to wear out than to rust out.