It depends on what kind of pipe you have.Cast iron could be caulk or nohub band. PVC is glued and also ABS is glued, iron pipe is screwed on. They make a repair flange to fix that so go to Plumbing supplyhouse are box store and tell them what you have there. The way you said about flange means that it is too low. The flange should be set on finish floor.
Art retired plbg