Relatively speaking, as long as it's on the latest version of android(android 13, 14 and maybe even 12), alongside the latest security patch. It should be fine. After that date, depending on what security issues pop up, it would be best to get a new device if required.
If you are worried and have reasons that make you believe it could be bad, consider saving up for an upgrade and combine trade-in offers to do so later.