If I want to test an App using a Sandbox account, I need to sign out from my Apple ID and sign in with the Sandbox one, so I need to keep going back and fourth between accounts.
My colleague, managed to have them both at the same time under Settings > App Store (See screenshot), but he doesn't know how he did it! And I can't find anything on this regard.
I don't have this option on my device!
Probably you have newer iOS version where the option has been moved.
You need to unlock the Developer settings and then go to Settings > Developer and scroll all the way down. There you can sign in to sandbox account for testing payments (while keeping your main account for the real stuff).
As noted in other answers, you first need to make a payment attempt from your app (debug build) for this option to appear.
This is a reference for it in official Apple docs: Sign in to the App Store with your Sandbox Apple Account
In iOS and iPadOS, the sandbox account appears in Settings > Developer after the first time you use the device to attempt a purchase in a development-signed app. There’s no need to sign out of the non-Sandbox Apple Account. Sign in using a Sandbox Apple Account.
Further notes
Email sub-adressing:
Some people in other posts report that sub-adressing (with a + in the email name) is rejected by Apple, furthermore it invalidates the test account (without letting you know). I cannot confirm, since my use case seems to be a bit special (see bellow), but If you have no other options left, try to create fresh email account without sub-addressing, e.g. on gmail.
My use case - Adyen TTP integration:
I am integrating Adyen SDK for Apple Tap to pay. This SDK keeps ignoring the sandbox account logged in in the described way and it always complains that it needs a sandbox account. The only way to get successful payment with sandbox account with this SDK, seems to be to logout from all accounts, including the main developer account (which apple clearly documents NOT to do, citation above) and log in with the sandbox account as the main iPhone account. This works even if I use sub-addressing of my main developer email address.