You can use the Divider composable with the width(xx.dp) modifier applying an intrinsic measurements to its parent container.
Something like:
Row(Modifier
.height(IntrinsicSize.Min) //intrinsic measurements
.fillMaxWidth()
.background(Color.Yellow)
) {
Text("First Text")
Divider(
color = Color.Red,
modifier = Modifier
.fillMaxHeight() //fill the max height
.width(1.dp)
)
Text("Second text")
}

As explained in the doc:
The Row composable’s
minIntrinsicHeightwill be the maximumminIntrinsicHeightof its children. TheDividerelement’sminIntrinsicHeightis0as it doesn’t occupy space if no constraints are given; theTextFieldminIntrinsicHeightwill be that of the content given a specific width. Therefore, theRowelement’s height constraint will be the maxminIntrinsicHeightof theTextFields content. TheDividerwill then expand its height to the height constraint given by theRow.