Easy, but not everyone known,
key function is EditorGUILayout.GetControlRect(); it return the “Next” rect that will be used from your inspector.
public static string MyEditorGUILayout(string input)
{
Rect rect = EditorGUILayout.GetControlRect();
return MyEditorGUI(rect, input);
}
public static string MyEditorGUI(Rect position, string input)
{
// draw your stuff with that "position".
}