The decay B±→KS0I¨±, with a CP asymmetry expected to be close to zero in the Standard Model, is theoretically clean and sensitive to potential new physics. An analysis of the decays B±→KS0I¨± and B±→KS0K± is performed using proton-proton collision data collected by the LHCb experiment at a center-of-mass energy of 13TeV, corresponding to an integrated luminosity of 5.4fb−1. The \CP asymmetries are determined to be ACP(B±→KS0I¨±)=−0.028±0.009±0.009 and ACP(B±→KS0K±)=0.118±0.062±0.031, and the branching fraction ratio is measured to be B(B±→KS0K±)/B(B±→KS0I¨±)=0.055±0.004±0.002, where the first uncertainties are statistical and the second are systematic. These results are the most precise measurements of these quantities to date. A search for the rare decay Bc±→KS0K± is also performed. No significant signal is observed, and the upper limit on the product of the branching fraction ratio B(Bc±→KS0K±)/B(B±→KS0I¨±) and the fragmentation-fraction ratio fc/fu is set to be 0.015 (0.016) at the 90\% (95\%) confidence level.