Two Long Island women are accused of endangering the welfare of a child after police say they were discovered in a parked SUV with bags of heroin.

The women were arrested Wednesday night in East Patchogue.

Tara Riley of Medford and Amanda Kosby of North Bellport were charged with criminal possession of a controlled substance, criminally possessing a hypodermic instrument and endangering the welfare of a child.

Riley’s 4-year-old daughter and Kosby’s 5-year-old son were in the back seat of the SUV.

Police say there were open bags of heroin on the front seat and the women told police they had gotten high earlier in the day.