If you are thinking of BASIC dialects of the 8-bit home microcomputers, then those computers did not have text editors (unless you bought some word processor application). There was no way to have the entire BASIC program source code "open in an editor", like you would have when programming today. Programmer wouldn't even think about the program as a source code file, or text, really.
So, lets say you have a simple program without line numbers in your head:
FOR I=1 TO 42
PRINT I
NEXT I
You boot up your computer. You have a prompt "ready" or something like that, and cursor sitting in next line. This is much like today's REPL environments of different scripting languages, though not really as strictly line based, more like screen based, but still that's a much closer analogy than text editor.
Now if you start entering the program, you might get error after first line, because BASIC interpreter tries to immediately execute (and forget) it, and it doesn't make sense without NEXT to end the loop. So you need some way to say, this is program line, store it! You could have a special symbol for it, let's try this:
#FOR I=1 TO 42
#PRINT I
#NEXT I
Ok, now our imaginary BASIC interpreter stored the program and you can run it. But now you want to edit the PRINT line. How do you do it? You are not in a text editor, you can't just move cursor to the line and edit it. Or you want to add another line like LET COUNT=COUNT+1 in the loop. How do you indicate where the new line should be inserted?
Line numbers solve this in a very easy, if rather klunky way. If you enter a program lone with line number that already exists, the old line gets replaced. Now the screen-based repl environment becomes useful, because you can just move cursor to program listing on screen, edit the line on screen and press ENTER to store it. This seems like you are editing the line, when in fact you are editing text on screen and then replacing the entire line with new one from the screen. Also, inserting new lines becomes easy if you leave unused numbers in between. To demonstrate:
10 FOR I=1 TO 42
20 PRINT I
30 NEXT I
After re-entering line 20 with changes, and adding new lines, it could be
5 COUNT=0
10 FOR I=1 TO 42
20 PRINT "Index", I
25 COUNT=COUNT+1
30 NEXT I
Another important function of line numbers in this environment is, you can LIST, that is print on screen, a range of lines by specifying the line numbers. Without line numbers, how would you specify what part of program you want to see, when you are not in editor where you can just move cursor and scroll through the text?
This is the reason line numbers survived as long as they did. They offer a way to do the actual programming without real editor. Once real editors became mainstream way to edit code, line number based BASIC dialects quickly disappeared from use, because the core usage problem they solved was no longer an issue.