Side questions:
1. If there are deposits to addresses where there are multiple large gaps in between these addresses, when I try to query for balance with extended private key, will the gap limit affect the balance shown to me? Because I’m think the wallet will stop at some point, even though there are bitcoin in the addresses subsequent after that.
yep gap limit does factor into it. you can modify it but the performance of the wallet software may suffer. you haven't told us what wallet you intend to use? if it's electrum then you may need to run your own electrum personal server and bitcoin core at the backend so that it can handle all the queries your wallet generates. you won't be able to rely on public servers.
another option is bitcoin core alone but you'll have to manually import the private keys for each address. bitcoin core's native derivation scheme uses hardened addresses which means you can't derive them using the xpub. so that's why you'll have to manually derive and import private keys corresponding to the derivation scheme you are using on your site.
2. Is it possible to combine bitcoin from different addresses when withdrawing? Say there is one bitcoin in 1st address and there is one bitcoin in the 1,000,000th address. If I want to withdraw 2 BTC, will the wallet able to combine the bitcoin from two addresses in a single transaction?
yes and that's what a wallet does automatically.