Slightly Android phone - just flash latest available LineageOS and install Termux and off you go.
Much older Android phone - probably not useful as a computer TBH, modern apps and websites need too much processing power.
Any other even older phone - perhaps useful for some home IoT/embedded stuff, not much more probably.
---
A modern Android phone with USB-C (must be USB3) is a full computer, I'm doing it. VSCode server running in the background + browser to access it, full Node.js installation + wired display, mouse, and keyboard plugged in USB-C dock. The launcher automatically switches to windowed mode when I plug in the display.
My only problem with this setup is the UX on-the-go. I'd love something like the old Transformer tablet/lapdock where you could slide the phone inside...