Find your IP address on the network you just connected to (the hotspot on other device) - it should be in WiFi settings, when you click on more details on the connection. Alternatively you could find it in output of ip a in Termux.
Open Android Proxy Server app and optionally adjust settings to your liking. (IP address to bind to - should be your phone’s on the hotspot, port, authentication)
Enable the proxy server that you want to use. If you’re connected through VPN, it will go through it. I use HTTP/HTTPS proxy.
Connect to the proxy server on your other device using your phone’s IP and the appropriate port. In Firefox go to settings, scroll down, click on network setup.
I use this to circumvent the 1 device limit of free ProtonVPN. Also on school network (with authentication enabled) to go through VPN and use NextDNS.