It depends on the context.
This sutta has a play on both meanings of loka - the objectively real world and the inner world of mental formations in this statement:
Mendicants, I say it’s not possible to know or see or reach the end of
the world by traveling. But I also say there’s no making an end of
suffering without reaching the end of the world.
This second meaning is explained in this statement (which also has both meanings of the word):
Whatever in the world through which you perceive the world and
conceive the world is called the world in the training of the noble
one.
The "world" in the training of the Noble Ones, refers to the world of mental formations through which we perceive (based on what is sensed of) the objectively real world and conceive the mental model of the world, which is the result of concept proliferation/ reification/ objectification-classification or papanca.
This is also found in the Rohitassa Sutta:
The end of the world can never
be reached by traveling.
But without reaching the end of the world,
there’s no release from suffering.
So a clever person, understanding the world,
has completed the spiritual journey, and gone to the end of the world.
A peaceful one, knowing the end of the world,
does not hope for this world or the next.”
So, the end of the world is the end of papanca (reification, objectification-classification, concept proliferation).
Piya Tan's commentary on the Lokantagamana Sutta:
2.1 In the Lok’anta Gamana Sutta,the Buddha, in simple words with profound senses, explains what it really means to “save the world.” We
need to first understand what “world” really means. In the Sabba Sutta
(S 35.23), the Buddha declares that all that there is are our 6
sense-faculties and their 6 respective sense-objects: these are the
“all” (sabba). This is the world, the universe, we have created for
ourselves. Nothing is meaningful for us beyond this.
2.2 The Buddha has never exhorted us to “save the world,” as this ultimately refers to all our senses, from which we liberate ourself.
Even when taunted by the wanderer Uttiya, who asks, with all the
Buddha’s attainments and teachings, “Is the whole world liberated by
this, or only half of it, or a third of it?” The Buddha remains
silent, because the question is wrongly put.
2.3 In an important sense, we can say that the Buddha’s teaching is about
“saving ourself” from the world. The world is what we make of
it: we create our own world. Hence, it is within our power to change
our “world,” that is our own self. This is the spirit of “renouncing
the world,” of letting go of the world so that we are free of the
falseness and unwholesomeness we have created for ourself. The save
the world, then, we need to renounce it.
2.4 In the Lok’anta Gamana Sutta 1 (S 35.116), the Buddha
declares what kind of “world” that we can really save or liberate. First, the
Buddha shows us what kind of world needs“saving”: Bhikshus, the end of
the world cannot be known, seen or reached by going, I say. Yet,
bhikshus, I also say that without reaching the end of the world there
is no making an end to suffering.8(S 35.116,2), SD 7.4 The first
mention of “the world” refers to the physical universe, which is with
neither beginning nor ending in terms of time and space
(okāsa,loka). It also refers to the world of beings (satta,loka),
simply put, the cycle of births and deaths (saṁsāra) itself, which
is external to us, so to speak. However, within us are the world of
formations (saṅkhārā,loka), the self-created and self-centred
“world”—this is our real prison of craving and ignorance, what we need
to awaken from and so be liberated.
2.5 The Lok’anta Gamana Sutta further records the Buddha as declaring,
“That in the world by which one is a perceiver of the world, a
conceiver of the world—this is called ‘the world’ in the noble one’s
discipline.”11(S 35.116,22). This refers to the workings of the 6
sense-bases. Then, the Buddha famously declares in the Rohitassa Sutta
(S 2.26):
In this very fathom-long body, endowed with perception and mind, I
declare the world, the arising of the world, the ending of the world,
and the way leading to the ending of the world.”12(S 2.26,9), SD 7.1