How to segment a number line of game objects between two points dynamically?

How can I dynamically segment a line between two points? For example, I want to put GameObjects between two points and as more objects get added, I want to segment the conceptual line by a number so I can have a multiple to separate the objects evenly. How would I go about it? Here is the code I was working with:

float distance = 0;
int numOfObjects = 1;
float segment = 0;

//Get the distance between two limits (left and right)
distance = Vector3.Distance(leftSide.transform.position, rightSide.transform.position);
//segment = leftSide.transform.position.x + rightSide.transform.position.x / numOfObjects;
numOfObjects = numOfObjects + 1;
float dist = Mathf.InverseLerp(rightSide.transform.position.x, leftSide.transform.position.x, distance / numOfObjects);
//float dist = Mathf.InverseLerp(rightSide.transform.position.x, leftSide.transform.position.x, distance);

//Set the position
someObject.transform.position = new Vector3(dist * numOfObjects, rightSide.transform.position.y, rightSide.transform.position.z);

I know that this is more of a math question, but any help would be appreciated.

You probably want to use Vector3.Lerp rather than Mathf.InverseLerp.

someObject.transform.position = Vector3.Lerp(
    leftSide.transform.position, 
    rightSide.transform.position, 
    thisSegment / (segments + 1)
);