Like say, you use the rogue's cunning action to disengage, then you ready your action to shoot at the enemy when an ally gets within 5 feet of them.
Would this work?
In the basic rules it states:
You choose when to take a bonus action during your turn, unless the bonus action's timing is specified, and anything that deprives you of your ability to take actions also prevents you from taking a bonus action.
So, unless the specific bonus action you are using states otherwise, then you can use it at any point on your turn, before or after your action. Examples of bonus actions that do indicate specific timings include the unarmed strike granted to Monks via the Martial Arts feature, and the additional attacks granted by Two-Weapon Fighting or the Crossbow Expert feat.
The Rogue's Cunning Action has no such limitation, so is fine to use before your action (whether you take the Ready action, or any other standard Action).