As stated, in the Bluetooth Menu of your iPhone is a list of in-range devices you can connect to. In this case it sounds like there was one nearby, but you did not connect to it. Once you are out of range those devices will disappear. Nothing to worry about there or in terms of your iPhone’s security, any personal information or your device cannot simply be compromised by Bluetooth. If a Bluetooth connection ever were to retrieve your messages or calls, such as for CarPlay, you would need to give explicit permissions in addition to connecting. Also, a lot of times connecting nowadays requires you to enter or match a pin with the accessory you are connecting to.
Also turning off Bluetooth when not in use won’t do anything, and in fact has some downsides. Firstly Bluetooth when not connected to a device uses no power. Secondly when turned off certain features won’t be able to work properly, such as Find My or your Apple Watch nearby.