You can use the FOSS application SimpleSSHD for this! You can get it directly from that link or using the F-droid app store on your phone.
Once setup you can connect to your device using either your LAN or WAN IP from your PC like this:
ssh -D 8899 <PHONE-IP>
-D option sets up
a local "dynamic" application-level port forwarding, which essentially makes ssh act like a SOCKS5 (SOCKS4 is supported aswell) proxy server.
After this, you can set your proxy to
127.0.0.1:8899 on your PC. I've tested it with curl:
curl --socks5 127.0.0.1:8899 https://myip.is
And it worked! Note that I did not even need root for this, it worked as the normal android user.
Note that if you want to use your mobile network for this your cell provider might not let you connect to SSHD using the WAN IP. A VPN can cirucmvent this if neccessary.