The orange square or dot in the status bar shows up when the mic is being used.
This feature is available in iOS 14 and later.
What Does the Orange Dot on iPhone Mean?

The orange indicator light is one of a few privacy features Apple introduced with iOS 14.
You will also see the orange indicator when making phone calls or using voice-to-text.
You may also see a green dot appearing on your iPhone in the same place as the orange dot.

Can You kill the Orange Dot on the iPhone?
SelectDisplay & Text Size.
Tap the toggle next toDifferentiate Without Color.

This will make the orange dot appear as an orange square.
The green dot will remain the same shape and color.
While the function itself can’t be turned off, youcanhide the orange dot.
To do that, simply shut down the app that’s using the mic.
Of course, the orange dot will turn on again the next time another app accesses the microphone.
It’s possible that one of the apps on your iPhone is accessing the microphone when it’s locked.