Often I'll go for takeout and they'll hand me my food in an paper bag. There's nothing wrong with this, but I tend to feel suspicious walking down the street with this unmarked brown paper bag. If a police officer stopped me for whatever reason, I'd explain that it was just my lunch, and I'd be 100% okay with handing it over so they could have a look inside and see that, yes, it's just a burrito and some chips.
What I would NOT be okay with is that escalating into “you let me search one thing, so now you also have to let me search your backpack, phone…”. I mean, if they thought my phone was fishy, I'd probably let them have a look, but the most I'd be okay with is a cursory examination, while I'm standing there, with the thing locked; and I certainly wouldn't provide my pin/password/fingerprint/face/whatever could be used to unlock it. Whether I'd be okay with having my backpack searched varies.
Are there any issues with this? Can you selectively consent to searches this way, or do you have to politely decline any search at all to prevent things spiraling out of control?