would a network select /24 or /23 path with ospf or with BGP which one is preferred !!
Most specific match (longest subnet mask match) will win regardless of routing protocol. If the subnet masks are equal, the route with the lowest administrative distance wins. In this case eBGP routes (learned from routers in different BGP Autonomous Systems) have a lower AD than OSPF routes, which have a lower AD than iBGP routes (learned from routers in the same BGP AS).
Worth noting - if the /24 is inside the /23, the other half of the /23 route will be honored. In other words, if you have a route for 18.104.22.168/23 pointing to 192.168.1.1 and a route for 22.214.171.124/24 pointing to 192.168.1.2, all traffic in 126.96.36.199/24 will go to 192.168.1.2 and all traffic in 188.8.131.52/24 will go to 192.168.1.1
/24 beats /23 eBGP beats OSPF beats iBGP