Hi @payel_roy , welcome to SimpleFOC!
Unfortunately an air-gap of 3mm is probably too big for the AS5600, or magnetic sensors in general. It’s at the very end of the recommended distance, so as you are experiencing, depending on the magnet, you won’t get a reliable signal.
And if this is for motor control, you’ll find that running the motor will further affect the signal quality due to magnetic and electrical interference.
So what can you do? One possibility you can try is to use a bigger, stronger magnet. With a bigger magnet it is possible the field strength will be stronger and the sensor will work better.
Otherwise I think you’ll have to reduce the air-gap, distances around 1mm tend to work well.