In and of itself, a history of having been previously detained by the UK immigration authorities will not prevent you from applying as an overstayer. However, whether or not you are detained by UK immigration authorities, overstaying may adversely impact your chances of succeeding with a future visa application. The exact impact will depend on why you overstayed, how long you overstayed for, and the type of future immigration application you may make.
Bear in mind that overstaying your visa can put you at risk of immigration detention, subject to certain requirements and exceptions. Furthermore, in the case of some types of visa applications made from outside the UK, if the applicant has overstayed for more than 28 days in the UK, the Home Office will automatically refuse the application for 12 months. However, this is not applicable to all types of UK visa applications.