A method for obtaining an identifier of a terminal device, comprising: obtaining, by a first network element, first information, wherein the first information carries location information of a first terminal device; determining, by the first network element, an identifier set based on the first information, wherein the identifier set comprises identifiers of N terminal devices, the N terminal devices comprise at least the first terminal device, and N is a positive integer; sending, by the first network element, N first request messages to a second network element, wherein the N first request messages carry the identifiers of the N terminal devices, and are used to request the second network element to determine location information of the N terminal devices; receiving, by the first network element, N first response messages from the second network element, wherein the N first response messages carry the location information of the N terminal devices; and determining, by the first network element, an identifier of the first terminal device in the identifier set by determining which third location in at least one third location specified by the location information of the N terminal devices is closest to the first location specified by the location information of the first terminal device, and using an identifier of a terminal device corresponding to the third location information as the identifier of the first terminal device; wherein the identifier of the first terminal device is an identifier used by the first terminal device for communication, and communication information of the first terminal device can be obtained based on the identifier of the first terminal device; wherein the first network element is a mobility management entity network element in a core network; wherein the second network element is a network element that performs a positioning algorithm in the core network; wherein location information of each terminal device in the location information of the N terminal devices comprises positioning precision information. obtaining, by a first network element, first information, wherein the first information carries location information of a first terminal device; determining, by the first network element, an identifier set based on the first information, wherein the identifier set comprises identifiers of N terminal devices, the N terminal devices comprise at least the first terminal device, and N is a positive integer; sending, by the first network element, N first request messages to a second network element, wherein the N first request messages carry the identifiers of the N terminal devices, and are used to request the second network element to determine location information of the N terminal devices; receiving, by the first network element, N first response messages from the second network element, wherein the N first response messages carry the location information of the N terminal devices; and determining, by the first network element, an identifier of the first terminal device in the identifier set by determining which third location in at least one third location specified by the location information of the N terminal devices is closest to the first location specified by the location information of the first terminal device, and using an identifier of a terminal device corresponding to the third location information as the identifier of the first terminal device; wherein the identifier of the first terminal device is an identifier used by the first terminal device for communication, and communication information of the first terminal device can be obtained based on the identifier of the first terminal device; wherein the first network element is a mobility management entity network element in a core network; wherein the second network element is a network element that performs a positioning algorithm in the core network; wherein location information of each terminal device in the location information of the N terminal devices comprises positioning precision information.