When Bitcoin gets to a stage where the mined supply is basically 21m (that is, very little remaining btc left to be mined), will Bitcoin still remain a secure network?
Depending on the price of Bitcoin in 2140 and how much bitcoin miners will get from transaction fees in one block.
The newest block
https://blockchair.com/bitcoin/block/689370 has 0.255
BTC for miners as transaction fee. If Bitcoin has its price at $1 M, that transaction fees will be $255,000.
If in 2140, miners don't get profit with transaction fees from their mining and confirmation, they will shut down their ASICs and the network might be less secured.